mirror of
https://github.com/holub/mame
synced 2025-07-05 09:57:47 +03:00
ui: some improvements with vertical orientation view. (nw - WIP)
This commit is contained in:
parent
29517da3e2
commit
434cb751f4
@ -2125,8 +2125,12 @@ 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,
|
||||
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,
|
||||
JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr);
|
||||
JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size);
|
||||
x1 += midl;
|
||||
}
|
||||
|
||||
@ -2143,6 +2147,7 @@ std::string ui_menu::arts_render_common(float origx1, float origy1, float origx2
|
||||
float line_height = mui.get_line_height();
|
||||
std::string snaptext, searchstr;
|
||||
get_title_search(snaptext, searchstr);
|
||||
float gutter_width = 0.4f * line_height * machine().render().ui_aspect() * 1.3f;
|
||||
|
||||
// apply title to right panel
|
||||
float title_size = 0.0f;
|
||||
@ -2166,12 +2171,17 @@ std::string ui_menu::arts_render_common(float origx1, float origy1, float origx2
|
||||
|
||||
float middle = origx2 - origx1;
|
||||
|
||||
// check size
|
||||
float sc = title_size + 2.0f * gutter_width;
|
||||
float tmp_size = (sc > middle) ? ((middle - 2.0f * gutter_width) / sc) : 1.0f;
|
||||
title_size *= tmp_size;
|
||||
|
||||
if (bgcolor != UI_TEXT_BG_COLOR)
|
||||
mui.draw_textured_box(container, origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f),
|
||||
origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
|
||||
|
||||
mui.draw_text_full(container, snaptext.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr);
|
||||
DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size);
|
||||
|
||||
draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::curimage_view, FIRST_VIEW, LAST_VIEW, title_size);
|
||||
|
||||
@ -2213,16 +2223,15 @@ void ui_menu::draw_toolbar(float x1, float y1, float x2, float y2, bool software
|
||||
if (t_bitmap[x]->valid())
|
||||
m_valid++;
|
||||
|
||||
float x_pixel = 1.0f / container->manager().ui_target().width();
|
||||
int h_len = mui.get_line_height() * container->manager().ui_target().height();
|
||||
h_len = (h_len % 2 == 0) ? h_len : h_len - 1;
|
||||
x1 = (x1 + x2) * 0.5f - x_pixel * (m_valid * ((h_len / 2) + 2));
|
||||
float space_x = (y2 - y1) * container->manager().ui_aspect();
|
||||
float total = (m_valid * space_x) + ((m_valid - 1) * 0.01f);
|
||||
x1 = ((x2 - x1) * 0.5f) - (total / 2);
|
||||
x2 = x1 + space_x;
|
||||
|
||||
for (int z = 0; z < UI_TOOLBAR_BUTTONS; ++z)
|
||||
{
|
||||
if (t_bitmap[z]->valid())
|
||||
{
|
||||
x2 = x1 + x_pixel * h_len;
|
||||
rgb_t color(0xEFEFEFEF);
|
||||
if (mouse_hit && x1 <= mouse_x && x2 > mouse_x && y1 <= mouse_y && y2 > mouse_y)
|
||||
{
|
||||
@ -2233,7 +2242,8 @@ void ui_menu::draw_toolbar(float x1, float y1, float x2, float y2, bool software
|
||||
}
|
||||
|
||||
container->add_quad(x1, y1, x2, y2, color, t_texture[z], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
x1 += x_pixel * (h_len + 2);
|
||||
x1 += space_x + ((z < UI_TOOLBAR_BUTTONS - 1) ? 0.01f : 0.0f);
|
||||
x2 = x1 + space_x;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2366,13 +2376,13 @@ void ui_menu::draw_common_arrow(float origx1, float origy1, float origx2, float
|
||||
|
||||
// apply arrow
|
||||
if (current == dmin)
|
||||
container->add_quad(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor_right, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90) | PRIMFLAG_PACKABLE);
|
||||
draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor_right, ROT90);
|
||||
else if (current == dmax)
|
||||
container->add_quad(al_x0, al_y0, al_x1, al_y1, fgcolor_left, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90 ^ ORIENTATION_FLIP_X) | PRIMFLAG_PACKABLE);
|
||||
draw_arrow(container, al_x0, al_y0, al_x1, al_y1, fgcolor_left, ROT90 ^ ORIENTATION_FLIP_X);
|
||||
else
|
||||
{
|
||||
container->add_quad(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor_right, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90) | PRIMFLAG_PACKABLE);
|
||||
container->add_quad(al_x0, al_y0, al_x1, al_y1, fgcolor_left, arrow_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90 ^ ORIENTATION_FLIP_X) | PRIMFLAG_PACKABLE);
|
||||
draw_arrow(container, ar_x0, ar_y0, ar_x1, ar_y1, fgcolor_right, ROT90);
|
||||
draw_arrow(container, al_x0, al_y0, al_x1, al_y1, fgcolor_left, ROT90 ^ ORIENTATION_FLIP_X);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2011,7 +2011,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or
|
||||
for (int x = UI_FIRST_LOAD; x < UI_LAST_LOAD; ++x)
|
||||
{
|
||||
mui.draw_text_full(container, _(dats_info[x]), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER,
|
||||
WRAP_TRUNCATE, DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_lenght, nullptr);
|
||||
WRAP_NEVER, DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_lenght, nullptr);
|
||||
txt_lenght += 0.01f;
|
||||
title_size = MAX(txt_lenght, title_size);
|
||||
}
|
||||
@ -2026,12 +2026,17 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or
|
||||
|
||||
float middle = origx2 - origx1;
|
||||
|
||||
// check size
|
||||
float sc = title_size + 2.0f * gutter_width;
|
||||
float tmp_size = (sc > middle) ? ((middle - 2.0f * gutter_width) / sc) : 1.0f;
|
||||
title_size *= tmp_size;
|
||||
|
||||
if (bgcolor != UI_TEXT_BG_COLOR)
|
||||
mui.draw_textured_box(container, origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f),
|
||||
origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
|
||||
|
||||
mui.draw_text_full(container, snaptext.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER,
|
||||
WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr);
|
||||
WRAP_NEVER, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size);
|
||||
|
||||
draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::curdats_view, UI_FIRST_LOAD, UI_LAST_LOAD, title_size);
|
||||
|
||||
@ -2084,7 +2089,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or
|
||||
if (topline_datsview + r_visible_lines >= totallines)
|
||||
topline_datsview = totallines - r_visible_lines;
|
||||
|
||||
float sc = origx2 - origx1 - (2.0f * UI_BOX_LR_BORDER);
|
||||
sc = origx2 - origx1 - (2.0f * UI_BOX_LR_BORDER);
|
||||
for (int r = 0; r < r_visible_lines; ++r)
|
||||
{
|
||||
int itemline = r + topline_datsview;
|
||||
|
@ -1578,7 +1578,7 @@ void ui_menu_select_software::infos_render(void *selectedref, float origx1, floa
|
||||
mui.draw_textured_box(container, origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f),
|
||||
origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
|
||||
|
||||
mui.draw_text_full(container, _("History"), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
mui.draw_text_full(container, _("History"), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_NEVER,
|
||||
DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr);
|
||||
ui_globals::cur_sw_dats_view = 0;
|
||||
}
|
||||
@ -1592,7 +1592,7 @@ void ui_menu_select_software::infos_render(void *selectedref, float origx1, floa
|
||||
|
||||
for (auto & elem : t_text)
|
||||
{
|
||||
mui.draw_text_full(container, elem.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_TRUNCATE,
|
||||
mui.draw_text_full(container, elem.c_str(), origx1, origy1, origx2 - origx1, JUSTIFY_CENTER, WRAP_NEVER,
|
||||
DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &txt_lenght, nullptr);
|
||||
txt_lenght += 0.01f;
|
||||
title_size = MAX(txt_lenght, title_size);
|
||||
@ -1608,12 +1608,17 @@ void ui_menu_select_software::infos_render(void *selectedref, float origx1, floa
|
||||
|
||||
float middle = origx2 - origx1;
|
||||
|
||||
// check size
|
||||
float sc = title_size + 2.0f * gutter_width;
|
||||
float tmp_size = (sc > middle) ? ((middle - 2.0f * gutter_width) / sc) : 1.0f;
|
||||
title_size *= tmp_size;
|
||||
|
||||
if (bgcolor != UI_TEXT_BG_COLOR)
|
||||
mui.draw_textured_box(container, origx1 + ((middle - title_size) * 0.5f), origy1, origx1 + ((middle + title_size) * 0.5f),
|
||||
origy1 + line_height, bgcolor, rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
|
||||
|
||||
mui.draw_text_full(container, t_text[ui_globals::cur_sw_dats_view].c_str(), origx1, origy1, origx2 - origx1,
|
||||
JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr);
|
||||
JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr, tmp_size);
|
||||
|
||||
draw_common_arrow(origx1, origy1, origx2, origy2, ui_globals::cur_sw_dats_view, 0, 1, title_size);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user