summaryrefslogtreecommitdiffstats
path: root/src/frontend/mame/ui/datmenu.cpp
diff options
context:
space:
mode:
author npwoods <npwoods@mess.org>2019-06-28 17:30:09 -0400
committer R. Belmont <rb6502@users.noreply.github.com>2019-06-28 17:30:09 -0400
commit697ff7bd7149d635a838543b65409dd42d739087 (patch)
tree23d49d81fd2b87ed565fac5c758b73b678fa7ad2 /src/frontend/mame/ui/datmenu.cpp
parentcec557538d0d55b11780e83ac60e0fef68b37e0d (diff)
Changed the various usages of UI_*COLOR to be calls to src/frontend/mame/ui/moptions.h (#5282)
* Changed the various usages of UI_*COLOR to be calls to src/frontend/mame/ui/moptions.h The various UI_*COLOR macros were implemented as calls to decode_ui_color, which cached the values for the various options in a static array, which was obviously a gross hack. This refactoring is strategic because I am trying to confine awareness of mame_ui_manager to code in src/frontend/mame/ui, and the implementation of decode_ui_color() relied on the ability to access mame_ui_manager as a singleton from outside this code. * Created a ui_colors object, so that queries for UI RGB values would not always require parsing strings * Converted a few more options().zyx_color() to colors().zyx_color() * A few more misses from earlier
Diffstat (limited to 'src/frontend/mame/ui/datmenu.cpp')
-rw-r--r--src/frontend/mame/ui/datmenu.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/frontend/mame/ui/datmenu.cpp b/src/frontend/mame/ui/datmenu.cpp
index 52e7416a43e..0dc5600a068 100644
--- a/src/frontend/mame/ui/datmenu.cpp
+++ b/src/frontend/mame/ui/datmenu.cpp
@@ -180,7 +180,7 @@ void menu_dats_view::draw(uint32_t flags)
float y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER + extra_height;
float line = visible_top + float(m_visible_lines) * line_height;
- ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, ui().colors().background_color());
m_visible_lines = (std::min)(visible_items, m_visible_lines);
top_line = (std::max)(0, top_line);
@@ -200,16 +200,16 @@ void menu_dats_view::draw(uint32_t flags)
float const line_x1 = x2 - 0.5f * UI_LINE_WIDTH;
float const line_y1 = line_y + line_height;
- rgb_t fgcolor = UI_TEXT_COLOR;
- rgb_t bgcolor = UI_TEXT_BG_COLOR;
+ rgb_t fgcolor = ui().colors().text_color();
+ rgb_t bgcolor = ui().colors().text_bg_color();
if (!linenum && top_line)
{
// if we're on the top line, display the up arrow
if (mouse_in_rect(line_x0, line_y0, line_x1, line_y1))
{
- fgcolor = UI_MOUSEOVER_COLOR;
- bgcolor = UI_MOUSEOVER_BG_COLOR;
+ fgcolor = ui().colors().mouseover_color();
+ bgcolor = ui().colors().mouseover_bg_color();
highlight(line_x0, line_y0, line_x1, line_y1, bgcolor);
set_hover(HOVER_ARROW_UP);
}
@@ -223,8 +223,8 @@ void menu_dats_view::draw(uint32_t flags)
// if we're on the bottom line, display the down arrow
if (mouse_in_rect(line_x0, line_y0, line_x1, line_y1))
{
- fgcolor = UI_MOUSEOVER_COLOR;
- bgcolor = UI_MOUSEOVER_BG_COLOR;
+ fgcolor = ui().colors().mouseover_color();
+ bgcolor = ui().colors().mouseover_bg_color();
highlight(line_x0, line_y0, line_x1, line_y1, bgcolor);
set_hover(HOVER_ARROW_DOWN);
}
@@ -253,8 +253,8 @@ void menu_dats_view::draw(uint32_t flags)
float const line_y0 = line;
float const line_x1 = x2 - 0.5f * UI_LINE_WIDTH;
float const line_y1 = line + line_height;
- rgb_t const fgcolor = UI_SELECTED_COLOR;
- rgb_t const bgcolor = UI_SELECTED_BG_COLOR;
+ rgb_t const fgcolor = ui().colors().selected_color();
+ rgb_t const bgcolor = ui().colors().selected_bg_color();
if (mouse_in_rect(line_x0, line_y0, line_x1, line_y1) && is_selectable(pitem))
set_hover(count);
@@ -263,7 +263,7 @@ void menu_dats_view::draw(uint32_t flags)
{
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().colors().text_color(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
else
{
@@ -315,7 +315,7 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f
y1 += UI_BOX_TB_BORDER;
ui().draw_text_full(container(), driver.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::NEVER,
- mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
+ mame_ui_manager::NORMAL, ui().colors().text_color(), ui().colors().text_bg_color(), nullptr, nullptr);
maxwidth = 0;
for (auto & elem : m_items_list)
@@ -334,7 +334,7 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f
y2 += ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER;
// draw a box
- ui().draw_outlined_box(container(), x1, y1, x2, y2, UI_BACKGROUND_COLOR);
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, ui().colors().background_color());
// take off the borders
y1 += UI_BOX_TB_BORDER;
@@ -344,11 +344,11 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f
for (auto & elem : m_items_list)
{
x1 += space;
- rgb_t fcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0x00) : UI_TEXT_COLOR;
- rgb_t bcolor = (m_actual == x) ? rgb_t(0xff, 0xff, 0xff, 0xff) : UI_TEXT_BG_COLOR;
+ 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.c_str(), x1, y1, 1.0f, ui::text_layout::LEFT, ui::text_layout::NEVER, mame_ui_manager::NONE, fcolor, bcolor, &width, nullptr);
- if (bcolor != UI_TEXT_BG_COLOR)
+ 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));
@@ -380,7 +380,7 @@ void menu_dats_view::custom_render(void *selectedref, float top, float bottom, f
// draw the text within it
ui().draw_text_full(container(), revision.c_str(), x1, y1, x2 - x1, ui::text_layout::CENTER, ui::text_layout::TRUNCATE,
- mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
+ mame_ui_manager::NORMAL, ui().colors().text_color(), ui().colors().text_bg_color(), nullptr, nullptr);
}
//-------------------------------------------------