diff options
author | 2021-10-12 03:56:42 +1100 | |
---|---|---|
committer | 2021-10-12 04:03:05 +1100 | |
commit | f494a0002471e5c5f905059c38b47995a7342c9f (patch) | |
tree | ea2cec423e703fa8b01b5c938803921e140edaed /src/frontend/mame/ui/datmenu.cpp | |
parent | 1668688eb412c0501d2161c1565e6c155380ee8d (diff) |
More UI enhancements/cleanup:
Made the headings in the info viewer clickable, so you can switch
between DATs with a mouse or trackball (or maybe a lightgun if that's
your thing).
Made the UI red/yellow/green traffic light status colours less
dirty-looking. The "yellow" is more of an amber-brown than a cat puke
brown now, and red is brighter. The contrast with white text is
definitely fine for red and green, but it's reduced a bit for yellow.
However there's a limit to how dark you can make a yellow or orange
colour before it looks muddy.
Reduced the number of places the UI uses red for things that aren't
errors. The error colour should be used sparingly, for actual errors.
Improved the colour swatch display in the RGBA colour editor. It now
has black/white underlay so alpha effects are move obvious. Also fixed
a bug preventing the channels being run down to zero.
Fixed double-clicking configure machine causing MAME to exit from the
system selection menu. Also slightly adjusted the colours of the
toolbar buttons again.
Diffstat (limited to 'src/frontend/mame/ui/datmenu.cpp')
-rw-r--r-- | src/frontend/mame/ui/datmenu.cpp | 82 |
1 files changed, 68 insertions, 14 deletions
diff --git a/src/frontend/mame/ui/datmenu.cpp b/src/frontend/mame/ui/datmenu.cpp index 6dabbc09223..f28651afdb5 100644 --- a/src/frontend/mame/ui/datmenu.cpp +++ b/src/frontend/mame/ui/datmenu.cpp @@ -317,14 +317,23 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f x2 -= lr_border; y1 += ui().box_tb_border(); - ui().draw_text_full(container(), driver, x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER, - mame_ui_manager::NORMAL, ui().colors().text_color(), ui().colors().text_bg_color(), nullptr, nullptr); + ui().draw_text_full( + container(), + driver, + x1, y1, x2 - x1, + ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, ui().colors().text_color(), ui().colors().text_bg_color()); maxwidth = 0; - for (auto & elem : m_items_list) + for (auto const &elem : m_items_list) { - ui().draw_text_full(container(), elem.label, 0.0f, 0.0f, 1.0f, ui::text_layout::CENTER, ui::text_layout::NEVER, - mame_ui_manager::NONE, rgb_t::white(), rgb_t::black(), &width, nullptr); + ui().draw_text_full( + container(), + elem.label, + 0.0f, 0.0f, 1.0f, + ui::text_layout::CENTER, ui::text_layout::NEVER, + mame_ui_manager::NONE, rgb_t::white(), rgb_t::black(), + &width, nullptr); maxwidth += width; } @@ -344,18 +353,38 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f // draw the text within it int x = 0; - for (auto & elem : m_items_list) + for (auto const &elem : m_items_list) { x1 += space; - rgb_t fcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0x00) : ui().colors().text_color(); - rgb_t bcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0xff) : ui().colors().text_bg_color(); - ui().draw_text_full(container(), elem.label, x1, y1, 1.0f, ui::text_layout::LEFT, ui::text_layout::NEVER, mame_ui_manager::NONE, fcolor, bcolor, &width, nullptr); + if (mouse_in_rect(x1 - (space / 2), y1, x1 + width + (space / 2), y2)) + set_hover(HOVER_INFO_TEXT + 1 + x); + + rgb_t const fcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0x00) : ui().colors().text_color(); + rgb_t const bcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0xff) : ui().colors().text_bg_color(); + ui().draw_text_full( + container(), + elem.label, + x1, y1, 1.0f, + ui::text_layout::LEFT, ui::text_layout::NEVER, + mame_ui_manager::NONE, fcolor, bcolor, + &width, nullptr); if (bcolor != ui().colors().text_bg_color()) - ui().draw_textured_box(container(), x1 - (space / 2), y1, x1 + width + (space / 2), y2, bcolor, rgb_t(255, 43, 43, 43), - hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(1)); + { + ui().draw_textured_box( + container(), + x1 - (space / 2), y1, x1 + width + (space / 2), y2, + bcolor, rgb_t(255, 43, 43, 43), + hilight_main_texture(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(1)); + } - ui().draw_text_full(container(), elem.label, x1, y1, 1.0f, ui::text_layout::LEFT, ui::text_layout::NEVER, mame_ui_manager::NORMAL, fcolor, bcolor, &width, nullptr); + ui().draw_text_full( + container(), + elem.label, + x1, y1, 1.0f, + ui::text_layout::LEFT, ui::text_layout::NEVER, + mame_ui_manager::NORMAL, fcolor, bcolor, + &width, nullptr); x1 += width + space; ++x; } @@ -382,8 +411,33 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f y1 += ui().box_tb_border(); // draw the text within it - ui().draw_text_full(container(), revision, x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE, - mame_ui_manager::NORMAL, ui().colors().text_color(), ui().colors().text_bg_color(), nullptr, nullptr); + ui().draw_text_full( + container(), + revision, + x1, y1, x2 - x1, + ui::text_layout::CENTER, ui::text_layout::TRUNCATE, + mame_ui_manager::NORMAL, ui().colors().text_color(), ui().colors().text_bg_color()); +} + +//------------------------------------------------- +// load data from DATs +//------------------------------------------------- + +bool menu_dats_view::custom_mouse_down() +{ + if ((hover() > HOVER_INFO_TEXT) && ((hover() - HOVER_INFO_TEXT) <= m_items_list.size())) + { + if ((hover() - HOVER_INFO_TEXT - 1) != m_actual) + { + m_actual = hover() - HOVER_INFO_TEXT - 1; + reset(reset_options::SELECT_FIRST); + } + return true; + } + else + { + return false; + } } //------------------------------------------------- |