mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
ui: The video mode in the menu display options are now obtained directly from the settings. (nw)
This commit is contained in:
parent
7a4e38987f
commit
68f167c886
@ -148,10 +148,9 @@ void ui_menu_command_content::populate()
|
|||||||
float gutter_width = 0.52f * line_height * machine().render().ui_aspect();
|
float gutter_width = 0.52f * line_height * machine().render().ui_aspect();
|
||||||
std::vector<int> xstart;
|
std::vector<int> xstart;
|
||||||
std::vector<int> xend;
|
std::vector<int> xend;
|
||||||
int total_lines;
|
|
||||||
convert_command_glyph(buffer);
|
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),
|
int total_lines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f,
|
||||||
total_lines, xstart, xend);
|
1.0f - (2.0f * UI_BOX_LR_BORDER) - 0.02f - (2.0f * gutter_width), xstart, xend);
|
||||||
for (int r = 0; r < total_lines; r++)
|
for (int r = 0; r < total_lines; r++)
|
||||||
{
|
{
|
||||||
std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[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();
|
float gutter_width = 0.52f * line_height * machine().render().ui_aspect();
|
||||||
std::vector<int> xstart;
|
std::vector<int> xstart;
|
||||||
std::vector<int> xend;
|
std::vector<int> xend;
|
||||||
int total_lines;
|
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);
|
||||||
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);
|
|
||||||
|
|
||||||
for (int r = 0; r < total_lines; r++)
|
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();
|
float gutter_width = 0.52f * line_height * machine().render().ui_aspect();
|
||||||
std::vector<int> xstart;
|
std::vector<int> xstart;
|
||||||
std::vector<int> xend;
|
std::vector<int> xend;
|
||||||
int tlines;
|
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);
|
||||||
|
|
||||||
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);
|
|
||||||
for (int r = 0; r < tlines; r++)
|
for (int r = 0; r < tlines; r++)
|
||||||
{
|
{
|
||||||
std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r]));
|
std::string tempbuf(buffer.substr(xstart[r], xend[r] - xstart[r]));
|
||||||
|
@ -21,17 +21,16 @@
|
|||||||
#include "../osd/modules/lib/osdobj_common.h"
|
#include "../osd/modules/lib/osdobj_common.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ui_menu_display_options::video_modes ui_menu_display_options::m_video[] = {
|
|
||||||
{ "auto", "Auto" },
|
ui_menu_display_options::video_modes ui_menu_display_options::m_video = {
|
||||||
{ "opengl", "OpenGL" },
|
{ "auto", "Auto" },
|
||||||
#if defined(UI_WINDOWS) && !defined(UI_SDL)
|
{ "opengl", "OpenGL" },
|
||||||
{ "d3d", "Direct3D" },
|
{ "bgfx", "BGFX" },
|
||||||
{ "gdi", "GDI" },
|
{ "d3d", "Direct3D" },
|
||||||
{ "ddraw", "DirectDraw" }
|
{ "gdi", "GDI" },
|
||||||
#else
|
{ "ddraw", "DirectDraw" },
|
||||||
{ "soft", "Software" },
|
{ "soft", "Software" },
|
||||||
{ "accel", "SDL2 Accelerated" }
|
{ "accel", "SDL2 Accelerated" }
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ui_menu_display_options::dspl_option ui_menu_display_options::m_options[] = {
|
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)
|
for (int d = 2; d < ARRAY_LENGTH(m_options); ++d)
|
||||||
m_options[d].status = options.int_value(m_options[d].option);
|
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;
|
m_options[1].status = 0;
|
||||||
for (int cur = 0; cur < ARRAY_LENGTH(m_video); ++cur)
|
for (int cur = 0; cur < m_list.size(); ++cur)
|
||||||
if (!core_stricmp(options.video(), m_video[cur].option))
|
if (options.video() == m_list[cur])
|
||||||
{
|
{
|
||||||
m_options[1].status = cur;
|
m_options[1].status = cur;
|
||||||
break;
|
break;
|
||||||
@ -83,15 +103,15 @@ ui_menu_display_options::~ui_menu_display_options()
|
|||||||
std::string error_string;
|
std::string error_string;
|
||||||
for (int d = 2; d < ARRAY_LENGTH(m_options); ++d)
|
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().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string);
|
||||||
machine().options().mark_changed(m_options[d].option);
|
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);
|
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))
|
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);
|
std::vector<std::string> s_sel(total);
|
||||||
for (int index = 0; index < total; ++index)
|
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));
|
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()
|
void ui_menu_display_options::populate()
|
||||||
{
|
{
|
||||||
// add video mode option
|
// add video mode option
|
||||||
std::string v_text(m_video[m_options[1].status].label);
|
std::string v_text(m_video[m_list[m_options[1].status]]);
|
||||||
UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_video) - 1, 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);
|
item_append(m_options[1].description, v_text.c_str(), arrow_flags, (void *)(FPTR)1);
|
||||||
|
|
||||||
// add options items
|
// add options items
|
||||||
for (int opt = 2; opt < ARRAY_LENGTH(m_options); ++opt)
|
for (int opt = 2; opt < ARRAY_LENGTH(m_options); ++opt)
|
||||||
if (strcmp(m_options[opt].option, OSDOPTION_PRESCALE) != 0)
|
if (strcmp(m_options[opt].option, OSDOPTION_PRESCALE) != 0)
|
||||||
item_append(m_options[opt].description, m_options[opt].status ? "On" : "Off",
|
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
|
else
|
||||||
{
|
{
|
||||||
strprintf(v_text, "%d", m_options[opt].status);
|
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;
|
float width;
|
||||||
ui_manager &mui = machine().ui();
|
ui_manager &mui = machine().ui();
|
||||||
mui.draw_text_full(container, "Display Options", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
mui.draw_text_full(container, "Display Options", 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE,
|
||||||
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
|
ARGB_WHITE, ARGB_BLACK, &width, nullptr);
|
||||||
width += 2 * UI_BOX_LR_BORDER;
|
width += 2 * UI_BOX_LR_BORDER;
|
||||||
float maxwidth = MAX(origx2 - origx1, width);
|
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;
|
y1 += UI_BOX_TB_BORDER;
|
||||||
|
|
||||||
// draw the text within it
|
// draw the text within it
|
||||||
mui.draw_text_full(container, "Display Options", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
mui.draw_text_full(container, "Display Options", x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL,
|
||||||
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
@ -33,14 +33,12 @@ private:
|
|||||||
const char *option;
|
const char *option;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct video_modes
|
using video_modes = std::unordered_map<std::string, std::string>;
|
||||||
{
|
|
||||||
const char *option;
|
|
||||||
const char *label;
|
|
||||||
};
|
|
||||||
|
|
||||||
static video_modes m_video[];
|
static video_modes m_video;
|
||||||
static dspl_option m_options[];
|
static dspl_option m_options[];
|
||||||
|
|
||||||
|
std::vector<std::string> m_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __UI_DSPLMENU_H__ */
|
#endif /* __UI_DSPLMENU_H__ */
|
||||||
|
@ -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 ud_arrow_width = line_height * machine().render().ui_aspect();
|
||||||
float gutter_width = lr_arrow_width * 1.3f;
|
float gutter_width = lr_arrow_width * 1.3f;
|
||||||
|
|
||||||
int selected_subitem_too_big = FALSE;
|
bool selected_subitem_too_big = false;
|
||||||
int itemnum, linenum;
|
int itemnum, linenum;
|
||||||
bool mouse_hit, mouse_button;
|
bool mouse_hit, mouse_button;
|
||||||
float mouse_x = -1, mouse_y = -1;
|
float mouse_x = -1, mouse_y = -1;
|
||||||
@ -662,7 +662,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput)
|
|||||||
{
|
{
|
||||||
subitem_text = "...";
|
subitem_text = "...";
|
||||||
if (itemnum == selected)
|
if (itemnum == selected)
|
||||||
selected_subitem_too_big = TRUE;
|
selected_subitem_too_big = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// customize subitem text color
|
// 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)
|
for (int x = 0; x < UI_TOOLBAR_BUTTONS; ++x)
|
||||||
{
|
{
|
||||||
toolbar_bitmap[x] = auto_alloc(machine, bitmap_argb32(32, 32));
|
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();
|
toolbar_texture[x] = mrender.texture_alloc();
|
||||||
|
sw_toolbar_texture[x] = mrender.texture_alloc();
|
||||||
UINT32 *dst = &toolbar_bitmap[x]->pix32(0);
|
UINT32 *dst = &toolbar_bitmap[x]->pix32(0);
|
||||||
memcpy(dst, toolbar_bitmap_bmp[x], 32 * 32 * sizeof(UINT32));
|
memcpy(dst, toolbar_bitmap_bmp[x], 32 * 32 * sizeof(UINT32));
|
||||||
if (toolbar_bitmap[x]->valid())
|
if (toolbar_bitmap[x]->valid())
|
||||||
toolbar_texture[x]->set_bitmap(*toolbar_bitmap[x], toolbar_bitmap[x]->cliprect(), TEXFORMAT_ARGB32);
|
toolbar_texture[x]->set_bitmap(*toolbar_bitmap[x], toolbar_bitmap[x]->cliprect(), TEXFORMAT_ARGB32);
|
||||||
else
|
else
|
||||||
toolbar_bitmap[x]->reset();
|
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)
|
if (x == 0 || x == 2)
|
||||||
{
|
{
|
||||||
UINT32 *dst;
|
|
||||||
dst = &sw_toolbar_bitmap[x]->pix32(0);
|
dst = &sw_toolbar_bitmap[x]->pix32(0);
|
||||||
memcpy(dst, toolbar_bitmap_bmp[x], 32 * 32 * sizeof(UINT32));
|
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
|
else
|
||||||
sw_toolbar_bitmap[x]->reset();
|
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 line_height = machine().ui().get_line_height();
|
||||||
float ud_arrow_width = line_height * machine().render().ui_aspect();
|
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;
|
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 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;
|
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;
|
float visible_extra_menu_height = customtop + custombottom + extra_height;
|
||||||
|
|
||||||
// locate mouse
|
// locate mouse
|
||||||
mouse_hit = FALSE;
|
mouse_hit = false;
|
||||||
mouse_button = FALSE;
|
mouse_button = false;
|
||||||
if (!noinput)
|
if (!noinput)
|
||||||
{
|
{
|
||||||
mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button);
|
mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button);
|
||||||
if (mouse_target != nullptr)
|
if (mouse_target != nullptr)
|
||||||
if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y))
|
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
|
// 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 we have some background hilighting to do, add a quad behind everything else
|
||||||
if (bgcolor != UI_TEXT_BG_COLOR)
|
if (bgcolor != UI_TEXT_BG_COLOR)
|
||||||
mui.draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1,
|
mui.draw_textured_box(container, line_x0 + 0.01f, line_y0, line_x1 - 0.01f, line_y1, bgcolor, rgb_t(255, 43, 43, 43),
|
||||||
bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture,
|
hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
|
||||||
PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
|
|
||||||
|
|
||||||
// if we're on the top line, display the up arrow
|
// if we're on the top line, display the up arrow
|
||||||
if (linenum == 0 && top_line != 0)
|
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
|
// if we're just a divider, draw a line
|
||||||
else if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0)
|
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,
|
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
|
// draw the item centered
|
||||||
else if (pitem.subtext == nullptr)
|
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;
|
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,
|
mui.draw_text_full(container, itemtext, effective_left + space, line_y, effective_width - space, JUSTIFY_LEFT, WRAP_TRUNCATE,
|
||||||
JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor,
|
DRAW_NORMAL, item_invert ? fgcolor3 : fgcolor, bgcolor, nullptr, nullptr);
|
||||||
bgcolor, nullptr, nullptr);
|
|
||||||
}
|
}
|
||||||
else
|
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 we have some background hilighting to do, add a quad behind everything else
|
||||||
if (bgcolor != UI_TEXT_BG_COLOR)
|
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),
|
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)
|
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,
|
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
|
else
|
||||||
mui.draw_text_full(container, itemtext, effective_left, line, effective_width,
|
mui.draw_text_full(container, itemtext, effective_left, line, effective_width, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||||
JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr);
|
DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr);
|
||||||
line += line_height;
|
line += line_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,7 +650,7 @@ void ui_menu_select_game::populate()
|
|||||||
{
|
{
|
||||||
UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW;
|
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;
|
old_item_selected = curitem;
|
||||||
|
|
||||||
bool cloneof = strcmp(m_displaylist[curitem]->parent, "0");
|
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;
|
UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW | MENU_FLAG_UI_FAVORITE;
|
||||||
if (mfavorite.startempty == 1)
|
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;
|
old_item_selected = curitem;
|
||||||
|
|
||||||
bool cloneof = strcmp(mfavorite.driver->parent, "0");
|
bool cloneof = strcmp(mfavorite.driver->parent, "0");
|
||||||
@ -695,7 +695,7 @@ void ui_menu_select_game::populate()
|
|||||||
}
|
}
|
||||||
else
|
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;
|
old_item_selected = curitem;
|
||||||
item_append(mfavorite.longname.c_str(), mfavorite.devicetype.c_str(),
|
item_append(mfavorite.longname.c_str(), mfavorite.devicetype.c_str(),
|
||||||
mfavorite.parentname.empty() ? flags_ui : (MENU_FLAG_INVERT | flags_ui), (void *)&mfavorite);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
else if (ui_globals::curdats_view != UI_STORY_LOAD && ui_globals::curdats_view != UI_COMMAND_LOAD)
|
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
|
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));
|
int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size));
|
||||||
if (totallines < r_visible_lines)
|
if (totallines < r_visible_lines)
|
||||||
@ -2364,7 +2364,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
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));
|
int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size));
|
||||||
if (totallines < r_visible_lines)
|
if (totallines < r_visible_lines)
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include "ui/datfile.h"
|
#include "ui/datfile.h"
|
||||||
#include "ui/inifile.h"
|
#include "ui/inifile.h"
|
||||||
#include "ui/selector.h"
|
#include "ui/selector.h"
|
||||||
#include "ui/custmenu.h"
|
|
||||||
#include "rendfont.h"
|
#include "rendfont.h"
|
||||||
#include "rendutil.h"
|
#include "rendutil.h"
|
||||||
#include "softlist.h"
|
#include "softlist.h"
|
||||||
@ -416,8 +415,7 @@ void ui_menu_select_software::populate()
|
|||||||
if (reselect_last::software == "[Start empty]" && !reselect_last::driver.empty())
|
if (reselect_last::software == "[Start empty]" && !reselect_last::driver.empty())
|
||||||
old_software = 0;
|
old_software = 0;
|
||||||
|
|
||||||
else if (!reselect_last::software.empty() && m_displaylist[curitem]->shortname == reselect_last::software
|
else if (m_displaylist[curitem]->shortname == reselect_last::software && m_displaylist[curitem]->listname == reselect_last::swlist)
|
||||||
&& m_displaylist[curitem]->listname == reselect_last::swlist)
|
|
||||||
old_software = m_has_empty_start ? curitem + 1 : curitem;
|
old_software = m_has_empty_start ? curitem + 1 : curitem;
|
||||||
|
|
||||||
item_append(m_displaylist[curitem]->longname.c_str(), m_displaylist[curitem]->devicetype.c_str(),
|
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)
|
if (ui_swinfo->startempty == 1)
|
||||||
{
|
{
|
||||||
std::vector<s_bios> biosname;
|
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));
|
ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(machine(), container, biosname, (void *)ui_swinfo->driver, false, true));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1479,8 +1477,7 @@ void ui_menu_select_software::infos_render(void *selectedref, float origx1, floa
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), totallines,
|
totallines = mui.wrap_text(container, buffer.c_str(), origx1, origy1, origx2 - origx1 - (2.0f * gutter_width), xstart, xend, text_size);
|
||||||
xstart, xend, text_size);
|
|
||||||
|
|
||||||
int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size));
|
int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size));
|
||||||
if (totallines < r_visible_lines)
|
if (totallines < r_visible_lines)
|
||||||
|
@ -2591,7 +2591,7 @@ void ui_manager::set_use_natural_keyboard(bool use_natural_keyboard)
|
|||||||
// wrap_text
|
// 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;
|
float lineheight = get_line_height() * text_size;
|
||||||
const char *ends = origs + strlen(origs);
|
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;
|
const char *linestart;
|
||||||
float maxwidth = 0;
|
float maxwidth = 0;
|
||||||
float aspect = machine().render().ui_aspect(container);
|
float aspect = machine().render().ui_aspect(container);
|
||||||
count = 0;
|
int count = 0;
|
||||||
|
|
||||||
// loop over lines
|
// loop over lines
|
||||||
while (*s != 0)
|
while (*s != 0)
|
||||||
@ -2716,6 +2716,7 @@ void ui_manager::wrap_text(render_container *container, const char *origs, float
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
@ -172,7 +172,7 @@ public:
|
|||||||
void process_natural_keyboard();
|
void process_natural_keyboard();
|
||||||
|
|
||||||
// word wrap
|
// 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
|
// 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));
|
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));
|
||||||
|
@ -16,9 +16,6 @@
|
|||||||
#include "osdepend.h"
|
#include "osdepend.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "libjpeg/jpeglib.h"
|
#include "libjpeg/jpeglib.h"
|
||||||
//#include <algorithm>
|
|
||||||
//#include "drivenum.h"
|
|
||||||
//#include <map>
|
|
||||||
|
|
||||||
#define MAX_CHAR_INFO 256
|
#define MAX_CHAR_INFO 256
|
||||||
#define MAX_CUST_FILTER 8
|
#define MAX_CUST_FILTER 8
|
||||||
|
Loading…
Reference in New Issue
Block a user