diff options
-rw-r--r-- | src/emu/ui/datmenu.cpp | 15 | ||||
-rw-r--r-- | src/emu/ui/dsplmenu.cpp | 70 | ||||
-rw-r--r-- | src/emu/ui/dsplmenu.h | 10 | ||||
-rw-r--r-- | src/emu/ui/menu.cpp | 49 | ||||
-rw-r--r-- | src/emu/ui/selgame.cpp | 12 | ||||
-rw-r--r-- | src/emu/ui/selsoft.cpp | 9 | ||||
-rw-r--r-- | src/emu/ui/ui.cpp | 5 | ||||
-rw-r--r-- | src/emu/ui/ui.h | 2 | ||||
-rw-r--r-- | src/emu/ui/utils.h | 3 |
9 files changed, 90 insertions, 85 deletions
diff --git a/src/emu/ui/datmenu.cpp b/src/emu/ui/datmenu.cpp index 2f8a8490a9b..72ab7509ae0 100644 --- a/src/emu/ui/datmenu.cpp +++ b/src/emu/ui/datmenu.cpp @@ -148,10 +148,9 @@ void ui_menu_command_content::populate() float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); std::vector<int> xstart; std::vector<int> xend; - int total_lines; convert_command_glyph(buffer); - machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), - total_lines, xstart, xend); + int total_lines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, + 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), xstart, xend); for (int r = 0; r < total_lines; r++) { std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r])); @@ -294,10 +293,8 @@ void ui_menu_history_sw::populate() float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); std::vector<int> xstart; std::vector<int> xend; - int total_lines; - - machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), - total_lines, xstart, xend); + int total_lines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), + xstart, xend); for (int r = 0; r < total_lines; r++) { @@ -544,9 +541,7 @@ bool ui_menu_dats::get_data(const game_driver *driver, int flags) float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); std::vector<int> xstart; std::vector<int> xend; - int tlines; - - machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), tlines, xstart, xend); + int tlines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), xstart, xend); for (int r = 0; r < tlines; r++) { std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r])); diff --git a/src/emu/ui/dsplmenu.cpp b/src/emu/ui/dsplmenu.cpp index cea63f34759..71ca4812cf8 100644 --- a/src/emu/ui/dsplmenu.cpp +++ b/src/emu/ui/dsplmenu.cpp @@ -21,17 +21,16 @@ #include "../osd/modules/lib/osdobj_common.h" #endif -ui_menu_display_options::video_modes ui_menu_display_options::m_video[] = { - { "auto", "Auto" }, - { "opengl", "OpenGL" }, -#if defined(UI_WINDOWS) && !defined(UI_SDL) - { "d3d", "Direct3D" }, - { "gdi", "GDI" }, - { "ddraw", "DirectDraw" } -#else - { "soft", "Software" }, - { "accel", "SDL2 Accelerated" } -#endif + +ui_menu_display_options::video_modes ui_menu_display_options::m_video = { + { "auto", "Auto" }, + { "opengl", "OpenGL" }, + { "bgfx", "BGFX" }, + { "d3d", "Direct3D" }, + { "gdi", "GDI" }, + { "ddraw", "DirectDraw" }, + { "soft", "Software" }, + { "accel", "SDL2 Accelerated" } }; ui_menu_display_options::dspl_option ui_menu_display_options::m_options[] = { @@ -65,9 +64,30 @@ ui_menu_display_options::ui_menu_display_options(running_machine &machine, rende for (int d = 2; d < ARRAY_LENGTH(m_options); ++d) m_options[d].status = options.int_value(m_options[d].option); + // create video list + m_list.push_back("auto"); + + std::string descr = options.description(OSDOPTION_VIDEO); + std::string delim = ", "; + descr.erase(0, descr.find(":") + 2); + size_t start = 0; + size_t end = descr.find_first_of(delim, start); + while (end != std::string::npos) + { + std::string name = descr.substr(start, end - start); + if (name != "none" && name != "or") + m_list.push_back(name); + start = descr.find_first_not_of(delim, end); + if (start == std::string::npos) + break; + end = descr.find_first_of(delim, start); + if (end == std::string::npos) + end = descr.size(); + } + m_options[1].status = 0; - for (int cur = 0; cur < ARRAY_LENGTH(m_video); ++cur) - if (!core_stricmp(options.video(), m_video[cur].option)) + for (int cur = 0; cur < m_list.size(); ++cur) + if (options.video() == m_list[cur]) { m_options[1].status = cur; break; @@ -83,15 +103,15 @@ ui_menu_display_options::~ui_menu_display_options() std::string error_string; for (int d = 2; d < ARRAY_LENGTH(m_options); ++d) { - if (machine().options().int_value(m_options[d].option)!=m_options[d].status) + if (machine().options().int_value(m_options[d].option) != m_options[d].status) { machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); machine().options().mark_changed(m_options[d].option); } } - if (strcmp(machine().options().value(m_options[1].option), m_video[m_options[1].status].option)!=0) + if (machine().options().value(m_options[1].option) != m_list[m_options[1].status]) { - machine().options().set_value(m_options[1].option, m_video[m_options[1].status].option, OPTION_PRIORITY_CMDLINE, error_string); + machine().options().set_value(m_options[1].option, m_list[m_options[1].status].c_str(), OPTION_PRIORITY_CMDLINE, error_string); machine().options().mark_changed(m_options[1].option); } @@ -122,10 +142,10 @@ void ui_menu_display_options::handle() } else if (m_event->iptkey == IPT_UI_SELECT && !strcmp(m_options[value].option, OSDOPTION_VIDEO)) { - int total = ARRAY_LENGTH(m_video); + int total = m_list.size(); std::vector<std::string> s_sel(total); for (int index = 0; index < total; ++index) - s_sel[index] = m_video[index].label; + s_sel[index] = m_video[m_list[index]]; ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, m_options[value].status)); } @@ -148,15 +168,15 @@ void ui_menu_display_options::handle() void ui_menu_display_options::populate() { // add video mode option - std::string v_text(m_video[m_options[1].status].label); - UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_video) - 1, m_options[1].status); + std::string v_text(m_video[m_list[m_options[1].status]]); + UINT32 arrow_flags = get_arrow_flags(0, m_list.size() - 1, m_options[1].status); item_append(m_options[1].description, v_text.c_str(), arrow_flags, (void *)(FPTR)1); // add options items for (int opt = 2; opt < ARRAY_LENGTH(m_options); ++opt) if (strcmp(m_options[opt].option, OSDOPTION_PRESCALE) != 0) item_append(m_options[opt].description, m_options[opt].status ? "On" : "Off", - m_options[opt].status ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)opt); + m_options[opt].status ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)opt); else { strprintf(v_text, "%d", m_options[opt].status); @@ -176,8 +196,8 @@ void ui_menu_display_options::custom_render(void *selectedref, float top, float { float width; ui_manager &mui = machine().ui(); - mui.draw_text_full(container, "Display Options", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); + mui.draw_text_full(container, "Display Options", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, + ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; float maxwidth = MAX(origx2 - origx1, width); @@ -196,6 +216,6 @@ void ui_menu_display_options::custom_render(void *selectedref, float top, float y1 += UI_BOX_TB_BORDER; // draw the text within it - mui.draw_text_full(container, "Display Options", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, - DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); + mui.draw_text_full(container, "Display Options", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, + UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } diff --git a/src/emu/ui/dsplmenu.h b/src/emu/ui/dsplmenu.h index 364ce12844e..814304ec6bd 100644 --- a/src/emu/ui/dsplmenu.h +++ b/src/emu/ui/dsplmenu.h @@ -33,14 +33,12 @@ private: const char *option; }; - struct video_modes - { - const char *option; - const char *label; - }; + using video_modes = std::unordered_map<std::string, std::string>; - static video_modes m_video[]; + static video_modes m_video; static dspl_option m_options[]; + + std::vector<std::string> m_list; }; #endif /* __UI_DSPLMENU_H__ */ diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index da22c83e126..bd1eec20c05 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -459,7 +459,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) float ud_arrow_width = line_height * machine().render().ui_aspect(); float gutter_width = lr_arrow_width * 1.3f; - int selected_subitem_too_big = FALSE; + bool selected_subitem_too_big = false; int itemnum, linenum; bool mouse_hit, mouse_button; float mouse_x = -1, mouse_y = -1; @@ -662,7 +662,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) { subitem_text = "..."; if (itemnum == selected) - selected_subitem_too_big = TRUE; + selected_subitem_too_big = true; } // customize subitem text color @@ -1326,29 +1326,28 @@ void ui_menu::init_ui(running_machine &machine) for (int x = 0; x < UI_TOOLBAR_BUTTONS; ++x) { toolbar_bitmap[x] = auto_alloc(machine, bitmap_argb32(32, 32)); + sw_toolbar_bitmap[x] = auto_alloc(machine, bitmap_argb32(32, 32)); toolbar_texture[x] = mrender.texture_alloc(); + sw_toolbar_texture[x] = mrender.texture_alloc(); UINT32 *dst = &toolbar_bitmap[x]->pix32(0); memcpy(dst, toolbar_bitmap_bmp[x], 32 * 32 * sizeof(UINT32)); if (toolbar_bitmap[x]->valid()) toolbar_texture[x]->set_bitmap(*toolbar_bitmap[x], toolbar_bitmap[x]->cliprect(), TEXFORMAT_ARGB32); else toolbar_bitmap[x]->reset(); - } - - // create a texture for toolbar - for (int x = 0; x < UI_TOOLBAR_BUTTONS; ++x) - { - sw_toolbar_bitmap[x] = auto_alloc(machine, bitmap_argb32(32, 32)); - sw_toolbar_texture[x] = mrender.texture_alloc(); + if (x == 0 || x == 2) { - UINT32 *dst; dst = &sw_toolbar_bitmap[x]->pix32(0); memcpy(dst, toolbar_bitmap_bmp[x], 32 * 32 * sizeof(UINT32)); - sw_toolbar_texture[x]->set_bitmap(*sw_toolbar_bitmap[x], sw_toolbar_bitmap[x]->cliprect(), TEXFORMAT_ARGB32); + if (sw_toolbar_bitmap[x]->valid()) + sw_toolbar_texture[x]->set_bitmap(*sw_toolbar_bitmap[x], sw_toolbar_bitmap[x]->cliprect(), TEXFORMAT_ARGB32); + else + sw_toolbar_bitmap[x]->reset(); } else sw_toolbar_bitmap[x]->reset(); + } } @@ -1361,7 +1360,7 @@ void ui_menu::draw_select_game(bool noinput) { float line_height = machine().ui().get_line_height(); float ud_arrow_width = line_height * machine().render().ui_aspect(); - float gutter_width = 0.4f * line_height * machine().render().ui_aspect() * 1.3f; + float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); mouse_x = -1, mouse_y = -1; float right_panel_size = (ui_globals::panels_status == HIDE_BOTH || ui_globals::panels_status == HIDE_RIGHT_PANEL) ? 2.0f * UI_BOX_LR_BORDER : 0.3f; float visible_width = 1.0f - 4.0f * UI_BOX_LR_BORDER; @@ -1381,14 +1380,14 @@ void ui_menu::draw_select_game(bool noinput) float visible_extra_menu_height = customtop + custombottom + extra_height; // locate mouse - mouse_hit = FALSE; - mouse_button = FALSE; + mouse_hit = false; + mouse_button = false; if (!noinput) { mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button); if (mouse_target != nullptr) if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y)) - mouse_hit = TRUE; + mouse_hit = true; } // account for extra space at the top and bottom @@ -1473,9 +1472,8 @@ void ui_menu::draw_select_game(bool noinput) // if we have some background hilighting to do, add a quad behind everything else if (bgcolor != UI_TEXT_BG_COLOR) - mui.draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, - bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture, - PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + mui.draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, bgcolor, rgb_t(255, 43, 43, 43), + hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); // if we're on the top line, display the up arrow if (linenum == 0 && top_line != 0) @@ -1498,7 +1496,7 @@ void ui_menu::draw_select_game(bool noinput) // if we're just a divider, draw a line else if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0) container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, - UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); // draw the item centered else if (pitem.subtext == nullptr) { @@ -1518,9 +1516,8 @@ void ui_menu::draw_select_game(bool noinput) space = mui.get_line_height() * container->manager().ui_aspect() * 1.5f; } - mui.draw_text_full(container, itemtext, effective_left + space, line_y, effective_width - space, - JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor, - bgcolor, nullptr, nullptr); + mui.draw_text_full(container, itemtext, effective_left + space, line_y, effective_width - space, JUSTIFY_LEFT, WRAP_TRUNCATE, + DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr); } else { @@ -1573,14 +1570,14 @@ void ui_menu::draw_select_game(bool noinput) // if we have some background hilighting to do, add a quad behind everything else if (bgcolor != UI_TEXT_BG_COLOR) mui.draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, bgcolor, rgb_t(255, 43, 43, 43), - hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); + hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0) container->add_line(visible_left, line + 0.5f * line_height, visible_left + visible_width, line + 0.5f * line_height, - UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); + UI_LINE_WIDTH, UI_TEXT_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); else - mui.draw_text_full(container, itemtext, effective_left, line, effective_width, - JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); + mui.draw_text_full(container, itemtext, effective_left, line, effective_width, JUSTIFY_CENTER, WRAP_TRUNCATE, + DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); line += line_height; } diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index 9642826e024..2b5139f6cc3 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -650,7 +650,7 @@ void ui_menu_select_game::populate() { UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; - if (old_item_selected == -1 && !reselect_last::driver.empty() && m_displaylist[curitem]->name == reselect_last::driver) + if (old_item_selected == -1 && m_displaylist[curitem]->name == reselect_last::driver) old_item_selected = curitem; bool cloneof = strcmp(m_displaylist[curitem]->parent, "0"); @@ -678,7 +678,7 @@ void ui_menu_select_game::populate() UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW | MENU_FLAG_UI_FAVORITE; if (mfavorite.startempty == 1) { - if (old_item_selected == -1 && !reselect_last::driver.empty() && mfavorite.shortname == reselect_last::driver) + if (old_item_selected == -1 && mfavorite.shortname == reselect_last::driver) old_item_selected = curitem; bool cloneof = strcmp(mfavorite.driver->parent, "0"); @@ -695,7 +695,7 @@ void ui_menu_select_game::populate() } else { - if (old_item_selected == -1 && !reselect_last::driver.empty() && mfavorite.shortname == reselect_last::driver) + if (old_item_selected == -1 && mfavorite.shortname == reselect_last::driver) old_item_selected = curitem; item_append(mfavorite.longname.c_str(), mfavorite.devicetype.c_str(), mfavorite.parentname.empty() ? flags_ui : (MENU_FLAG_INVERT | flags_ui), (void *)&mfavorite); @@ -2217,9 +2217,9 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or return; } else if (ui_globals::curdats_view != UI_STORY_LOAD && ui_globals::curdats_view != UI_COMMAND_LOAD) - mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), totallines, xstart, xend, text_size); + totallines = mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), xstart, xend, text_size); else - mui.wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * gutter_width), totallines, xstart, xend, text_size); + totallines = mui.wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (2.0f * gutter_width), xstart, xend, text_size); int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size)); if (totallines < r_visible_lines) @@ -2364,7 +2364,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or return; } else - mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), totallines, xstart, xend, text_size); + totallines = mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), xstart, xend, text_size); int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size)); if (totallines < r_visible_lines) diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp index fc3d21b550d..5d1acb27c34 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/emu/ui/selsoft.cpp @@ -19,7 +19,6 @@ #include "ui/datfile.h" #include "ui/inifile.h" #include "ui/selector.h" -#include "ui/custmenu.h" #include "rendfont.h" #include "rendutil.h" #include "softlist.h" @@ -416,8 +415,7 @@ void ui_menu_select_software::populate() if (reselect_last::software == "[Start empty]" && !reselect_last::driver.empty()) old_software = 0; - else if (!reselect_last::software.empty() && m_displaylist[curitem]->shortname == reselect_last::software - && m_displaylist[curitem]->listname == reselect_last::swlist) + else if (m_displaylist[curitem]->shortname == reselect_last::software && m_displaylist[curitem]->listname == reselect_last::swlist) old_software = m_has_empty_start ? curitem + 1 : curitem; item_append(m_displaylist[curitem]->longname.c_str(), m_displaylist[curitem]->devicetype.c_str(), @@ -822,7 +820,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) if (ui_swinfo->startempty == 1) { std::vector<s_bios> biosname; - if (has_multiple_bios(ui_swinfo->driver, biosname) && !mopt.skip_bios_menu()) + if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(machine(), container, biosname, (void *)ui_swinfo->driver, false, true)); else { @@ -1479,8 +1477,7 @@ void ui_menu_select_software::infos_render(void *selectedref, float origx1, floa return; } else - mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), totallines, - xstart, xend, text_size); + totallines = mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), xstart, xend, text_size); int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size)); if (totallines < r_visible_lines) diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 6d996ac50a0..013f1c5c4bb 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -2591,7 +2591,7 @@ void ui_manager::set_use_natural_keyboard(bool use_natural_keyboard) // wrap_text //------------------------------------------------- -void ui_manager::wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, int &count, std::vector<int> &xstart, std::vector<int> &xend, float text_size) +int ui_manager::wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, std::vector<int> &xstart, std::vector<int> &xend, float text_size) { float lineheight = get_line_height() * text_size; const char *ends = origs + strlen(origs); @@ -2600,7 +2600,7 @@ void ui_manager::wrap_text(render_container *container, const char *origs, float const char *linestart; float maxwidth = 0; float aspect = machine().render().ui_aspect(container); - count = 0; + int count = 0; // loop over lines while (*s != 0) @@ -2716,6 +2716,7 @@ void ui_manager::wrap_text(render_container *container, const char *origs, float break; } } + return count; } //------------------------------------------------- diff --git a/src/emu/ui/ui.h b/src/emu/ui/ui.h index 5a07a0800b5..9cfdfe4241a 100644 --- a/src/emu/ui/ui.h +++ b/src/emu/ui/ui.h @@ -172,7 +172,7 @@ public: void process_natural_keyboard(); // word wrap - void wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, int &totallines, std::vector<int> &xstart, std::vector<int> &xend, float text_size = 1.0f); + int wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, std::vector<int> &xstart, std::vector<int> &xend, float text_size = 1.0f); // draw an outlined box with given line color and filled with a texture void draw_textured_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor, rgb_t linecolor, render_texture *texture = nullptr, UINT32 flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); diff --git a/src/emu/ui/utils.h b/src/emu/ui/utils.h index 473ac5f32ea..f89b27d88e8 100644 --- a/src/emu/ui/utils.h +++ b/src/emu/ui/utils.h @@ -16,9 +16,6 @@ #include "osdepend.h" #include "render.h" #include "libjpeg/jpeglib.h" -//#include <algorithm> -//#include "drivenum.h" -//#include <map> #define MAX_CHAR_INFO 256 #define MAX_CUST_FILTER 8 |