summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/ui/selector.cpp
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2016-04-26 16:37:43 -0400
committer AJR <ajrhacker@users.noreply.github.com>2016-04-26 16:37:43 -0400
commite06384aaba8f618ad049d9fe933c76eccf24594a (patch)
treef61522b73dcae33281045d6a88f45034fd3310b0 /src/frontend/mame/ui/selector.cpp
parent0b1ca9b15dd8baf20ce4abd1879478e8dd65ecfb (diff)
Relieve UI menus and such from having to constantly fetch UI object from global state (nw)
Diffstat (limited to 'src/frontend/mame/ui/selector.cpp')
-rw-r--r--src/frontend/mame/ui/selector.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/frontend/mame/ui/selector.cpp b/src/frontend/mame/ui/selector.cpp
index 4f06bd961f4..34b911f2ddf 100644
--- a/src/frontend/mame/ui/selector.cpp
+++ b/src/frontend/mame/ui/selector.cpp
@@ -9,6 +9,7 @@
*********************************************************************/
#include "emu.h"
+#include "mame.h"
#include "ui/ui.h"
#include "ui/menu.h"
#include "ui/selector.h"
@@ -18,8 +19,8 @@
// ctor / dtor
//-------------------------------------------------
-ui_menu_selector::ui_menu_selector(running_machine &machine, render_container *container, std::vector<std::string> const &s_sel, UINT16 &s_actual, int category, int _hover)
- : ui_menu(machine, container)
+ui_menu_selector::ui_menu_selector(mame_ui_manager &mui, render_container *container, std::vector<std::string> const &s_sel, UINT16 &s_actual, int category, int _hover)
+ : ui_menu(mui, container)
, m_selector(s_actual)
, m_category(category)
, m_hover(_hover)
@@ -30,8 +31,8 @@ ui_menu_selector::ui_menu_selector(running_machine &machine, render_container *c
m_searchlist[0] = nullptr;
}
-ui_menu_selector::ui_menu_selector(running_machine &machine, render_container *container, std::vector<std::string> &&s_sel, UINT16 &s_actual, int category, int _hover)
- : ui_menu(machine, container)
+ui_menu_selector::ui_menu_selector(mame_ui_manager &mui, render_container *container, std::vector<std::string> &&s_sel, UINT16 &s_actual, int category, int _hover)
+ : ui_menu(mui, container)
, m_selector(s_actual)
, m_category(category)
, m_hover(_hover)
@@ -150,7 +151,7 @@ void ui_menu_selector::populate()
}
item_append(ui_menu_item_type::SEPARATOR);
- customtop = custombottom = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
+ customtop = custombottom = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
m_first_pass = false;
}
@@ -161,12 +162,11 @@ void ui_menu_selector::populate()
void ui_menu_selector::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
float width;
- mame_ui_manager &mui = mame_machine_manager::instance()->ui();
std::string tempbuf = std::string(_("Selection List - Search: ")).append(m_search).append("_");
// get the size of the text
- mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
- DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
+ ui().draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
+ DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += (2.0f * UI_BOX_LR_BORDER) + 0.01f;
float maxwidth = MAX(width, origx2 - origx1);
@@ -177,7 +177,7 @@ void ui_menu_selector::custom_render(void *selectedref, float top, float bottom,
float y2 = origy1 - UI_BOX_TB_BORDER;
// draw a box
- mui.draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
+ ui().draw_outlined_box(container, x1, y1, x2, y2, UI_GREEN_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -185,7 +185,7 @@ void ui_menu_selector::custom_render(void *selectedref, float top, float bottom,
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
+ ui().draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
// bottom text
@@ -193,8 +193,8 @@ void ui_menu_selector::custom_render(void *selectedref, float top, float bottom,
std::string ui_select_text = machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD));
tempbuf = string_format(_("Double click or press %1$s to select"), ui_select_text);
- mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER,
- DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
+ ui().draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER,
+ DRAW_NONE, rgb_t::white, rgb_t::black, &width, nullptr);
width += 2 * UI_BOX_LR_BORDER;
maxwidth = MAX(maxwidth, width);
@@ -205,7 +205,7 @@ void ui_menu_selector::custom_render(void *selectedref, float top, float bottom,
y2 = origy2 + bottom;
// draw a box
- mui.draw_outlined_box(container, x1, y1, x2, y2, UI_RED_COLOR);
+ ui().draw_outlined_box(container, x1, y1, x2, y2, UI_RED_COLOR);
// take off the borders
x1 += UI_BOX_LR_BORDER;
@@ -213,7 +213,7 @@ void ui_menu_selector::custom_render(void *selectedref, float top, float bottom,
y1 += UI_BOX_TB_BORDER;
// draw the text within it
- mui.draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
+ ui().draw_text_full(container, tempbuf.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER,
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}