mirror of
https://github.com/holub/mame
synced 2025-05-01 12:16:56 +03:00
ui: further improvement of the layout for viewing in vertical orientation. (nw - WIP)
This commit is contained in:
parent
bbb9fd448f
commit
f5fccc5c83
@ -2090,7 +2090,16 @@ float ui_menu::draw_right_box_title(float x1, float y1, float x2, float y2)
|
|||||||
buffer[RP_IMAGES] = _("Images");
|
buffer[RP_IMAGES] = _("Images");
|
||||||
buffer[RP_INFOS] = _("Infos");
|
buffer[RP_INFOS] = _("Infos");
|
||||||
|
|
||||||
for (int cells = RP_IMAGES; cells <= RP_INFOS; cells++)
|
// check size
|
||||||
|
float text_size = 1.0f;
|
||||||
|
for (auto & elem : buffer)
|
||||||
|
{
|
||||||
|
float textlen = mui.get_string_width(elem.c_str()) + 0.01f;
|
||||||
|
float tmp_size = (textlen > midl) ? (midl / textlen) : 1.0f;
|
||||||
|
text_size = MIN(text_size, tmp_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int cells = RP_FIRST; cells <= RP_LAST; ++cells)
|
||||||
{
|
{
|
||||||
rgb_t bgcolor = UI_TEXT_BG_COLOR;
|
rgb_t bgcolor = UI_TEXT_BG_COLOR;
|
||||||
rgb_t fgcolor = UI_TEXT_COLOR;
|
rgb_t fgcolor = UI_TEXT_COLOR;
|
||||||
@ -2125,12 +2134,8 @@ float ui_menu::draw_right_box_title(float x1, float y1, float x2, float y2)
|
|||||||
container->add_rect(x1 + UI_LINE_WIDTH, y1 + UI_LINE_WIDTH, x1 + midl - UI_LINE_WIDTH, y1 + line_height,
|
container->add_rect(x1 + UI_LINE_WIDTH, y1 + UI_LINE_WIDTH, x1 + midl - UI_LINE_WIDTH, y1 + line_height,
|
||||||
bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
|
bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
|
||||||
|
|
||||||
// check size
|
|
||||||
float textlen = mui.get_string_width(buffer[cells].c_str()) + 0.01f;
|
|
||||||
float tmp_size = (textlen > midl) ? (midl / textlen) : 1.0f;
|
|
||||||
|
|
||||||
mui.draw_text_full(container, buffer[cells].c_str(), x1 + UI_LINE_WIDTH, y1, midl - UI_LINE_WIDTH,
|
mui.draw_text_full(container, buffer[cells].c_str(), x1 + UI_LINE_WIDTH, y1, midl - UI_LINE_WIDTH,
|
||||||
JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size);
|
JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, text_size);
|
||||||
x1 += midl;
|
x1 += midl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -800,6 +800,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott
|
|||||||
bool isstar = false;
|
bool isstar = false;
|
||||||
ui_manager &mui = machine().ui();
|
ui_manager &mui = machine().ui();
|
||||||
float tbarspace = mui.get_line_height();
|
float tbarspace = mui.get_line_height();
|
||||||
|
float text_size = 1.0f;
|
||||||
|
|
||||||
tempbuf[0] = string_format(_("%1$s %2$s ( %3$d / %4$d machines (%5$d BIOS) )"),
|
tempbuf[0] = string_format(_("%1$s %2$s ( %3$d / %4$d machines (%5$d BIOS) )"),
|
||||||
emulator_info::get_appname(),
|
emulator_info::get_appname(),
|
||||||
@ -844,6 +845,12 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott
|
|||||||
maxwidth = MAX(width, maxwidth);
|
maxwidth = MAX(width, maxwidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (maxwidth > origx2 - origx1)
|
||||||
|
{
|
||||||
|
text_size = (origx2 - origx1) / maxwidth;
|
||||||
|
maxwidth = origx2 - origx1;
|
||||||
|
}
|
||||||
|
|
||||||
// compute our bounds
|
// compute our bounds
|
||||||
float x1 = 0.5f - 0.5f * maxwidth;
|
float x1 = 0.5f - 0.5f * maxwidth;
|
||||||
float x2 = x1 + maxwidth;
|
float x2 = x1 + maxwidth;
|
||||||
@ -862,7 +869,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott
|
|||||||
for (int line = 0; line < 2; ++line)
|
for (int line = 0; line < 2; ++line)
|
||||||
{
|
{
|
||||||
mui.draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
|
mui.draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
|
||||||
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
|
||||||
y1 += mui.get_line_height();
|
y1 += mui.get_line_height();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -992,6 +999,12 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott
|
|||||||
maxwidth = MAX(maxwidth, width);
|
maxwidth = MAX(maxwidth, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (maxwidth > origx2 - origx1)
|
||||||
|
{
|
||||||
|
text_size = (origx2 - origx1) / maxwidth;
|
||||||
|
maxwidth = origx2 - origx1;
|
||||||
|
}
|
||||||
|
|
||||||
// compute our bounds
|
// compute our bounds
|
||||||
x1 = 0.5f - 0.5f * maxwidth;
|
x1 = 0.5f - 0.5f * maxwidth;
|
||||||
x2 = x1 + maxwidth;
|
x2 = x1 + maxwidth;
|
||||||
@ -1014,7 +1027,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott
|
|||||||
for (auto & elem : tempbuf)
|
for (auto & elem : tempbuf)
|
||||||
{
|
{
|
||||||
mui.draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
|
mui.draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
|
||||||
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
|
||||||
y1 += mui.get_line_height();
|
y1 += mui.get_line_height();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,6 +303,7 @@ void ui_menu_select_software::handle()
|
|||||||
|
|
||||||
if (m_event != nullptr && m_event->itemref == nullptr)
|
if (m_event != nullptr && m_event->itemref == nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (m_event->iptkey == IPT_UI_CONFIGURE)
|
if (m_event->iptkey == IPT_UI_CONFIGURE)
|
||||||
inkey_configure(m_event);
|
inkey_configure(m_event);
|
||||||
|
|
||||||
@ -674,6 +675,7 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float
|
|||||||
rgb_t color = UI_BACKGROUND_COLOR;
|
rgb_t color = UI_BACKGROUND_COLOR;
|
||||||
bool isstar = false;
|
bool isstar = false;
|
||||||
float tbarspace = mui.get_line_height();
|
float tbarspace = mui.get_line_height();
|
||||||
|
float text_size = 1.0f;
|
||||||
|
|
||||||
// determine the text for the header
|
// determine the text for the header
|
||||||
int vis_item = (m_search[0] != 0) ? visible_items : (m_has_empty_start ? visible_items - 1 : visible_items);
|
int vis_item = (m_search[0] != 0) ? visible_items : (m_has_empty_start ? visible_items - 1 : visible_items);
|
||||||
@ -704,6 +706,12 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float
|
|||||||
maxwidth = MAX(width, maxwidth);
|
maxwidth = MAX(width, maxwidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (maxwidth > origx2 - origx1)
|
||||||
|
{
|
||||||
|
text_size = (origx2 - origx1) / maxwidth;
|
||||||
|
maxwidth = origx2 - origx1;
|
||||||
|
}
|
||||||
|
|
||||||
// compute our bounds
|
// compute our bounds
|
||||||
float x1 = 0.5f - 0.5f * maxwidth;
|
float x1 = 0.5f - 0.5f * maxwidth;
|
||||||
float x2 = x1 + maxwidth;
|
float x2 = x1 + maxwidth;
|
||||||
@ -722,7 +730,7 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float
|
|||||||
for (int line = 0; line < 3; ++line)
|
for (int line = 0; line < 3; ++line)
|
||||||
{
|
{
|
||||||
mui.draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
|
mui.draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
|
||||||
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
|
||||||
y1 += mui.get_line_height();
|
y1 += mui.get_line_height();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -849,6 +857,12 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float
|
|||||||
maxwidth = MAX(maxwidth, width);
|
maxwidth = MAX(maxwidth, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (maxwidth > origx2 - origx1)
|
||||||
|
{
|
||||||
|
text_size = (origx2 - origx1) / maxwidth;
|
||||||
|
maxwidth = origx2 - origx1;
|
||||||
|
}
|
||||||
|
|
||||||
// compute our bounds
|
// compute our bounds
|
||||||
x1 = 0.5f - 0.5f * maxwidth;
|
x1 = 0.5f - 0.5f * maxwidth;
|
||||||
x2 = x1 + maxwidth;
|
x2 = x1 + maxwidth;
|
||||||
@ -871,7 +885,7 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float
|
|||||||
for (auto & elem : tempbuf)
|
for (auto & elem : tempbuf)
|
||||||
{
|
{
|
||||||
mui.draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
|
mui.draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
|
||||||
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
|
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size);
|
||||||
y1 += machine().ui().get_line_height();
|
y1 += machine().ui().get_line_height();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user