diff options
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; + } } //------------------------------------------------- |