summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/frontend/mame/ui/custui.cpp189
-rw-r--r--src/frontend/mame/ui/datmenu.cpp82
-rw-r--r--src/frontend/mame/ui/datmenu.h1
-rw-r--r--src/frontend/mame/ui/dirmenu.cpp2
-rw-r--r--src/frontend/mame/ui/selector.cpp2
-rw-r--r--src/frontend/mame/ui/selmenu.cpp6
-rw-r--r--src/frontend/mame/ui/submenu.cpp2
-rw-r--r--src/frontend/mame/ui/toolbar.ipp6
-rw-r--r--src/frontend/mame/ui/ui.h6
9 files changed, 159 insertions, 137 deletions
diff --git a/src/frontend/mame/ui/custui.cpp b/src/frontend/mame/ui/custui.cpp
index 9b06465f9f8..d926394878c 100644
--- a/src/frontend/mame/ui/custui.cpp
+++ b/src/frontend/mame/ui/custui.cpp
@@ -623,7 +623,7 @@ void menu_colors_ui::custom_render(void *selectedref, float top, float bottom, f
std::begin(bottomtext), std::end(bottomtext),
origx1, origx2, origy2 + ui().box_tb_border(), origy2 + bottom,
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false,
- ui().colors().text_color(), UI_RED_COLOR, 1.0f);
+ ui().colors().text_color(), ui().colors().background_color(), 1.0f);
// compute maxwidth
char const *const topbuf = _("Menu Preview");
@@ -751,8 +751,6 @@ menu_rgb_ui::~menu_rgb_ui()
void menu_rgb_ui::handle()
{
- bool changed = false;
-
// process the menu
const event *menu_event;
@@ -761,103 +759,63 @@ void menu_rgb_ui::handle()
else
menu_event = process(PROCESS_ONLYCHAR);
- if (menu_event != nullptr && menu_event->itemref != nullptr)
+ if (menu_event && menu_event->itemref != nullptr)
{
- switch ((uintptr_t)menu_event->itemref)
+ bool changed = false;
+ switch (menu_event->iptkey)
{
- case RGB_ALPHA:
- if (menu_event->iptkey == IPT_UI_LEFT && m_color->a() > 1)
- {
- m_color->set_a(m_color->a() - 1);
- changed = true;
- }
-
- else if (menu_event->iptkey == IPT_UI_RIGHT && m_color->a() < 255)
- {
- m_color->set_a(m_color->a() + 1);
- changed = true;
- }
-
- else if (menu_event->iptkey == IPT_UI_SELECT || menu_event->iptkey == IPT_SPECIAL)
- {
- inkey_special(menu_event);
- changed = true;
- }
-
- break;
-
- case RGB_RED:
- if (menu_event->iptkey == IPT_UI_LEFT && m_color->r() > 1)
- {
- m_color->set_r(m_color->r() - 1);
- changed = true;
- }
-
- else if (menu_event->iptkey == IPT_UI_RIGHT && m_color->r() < 255)
- {
- m_color->set_r(m_color->r() + 1);
- changed = true;
- }
-
- else if (menu_event->iptkey == IPT_UI_SELECT || menu_event->iptkey == IPT_SPECIAL)
- {
- inkey_special(menu_event);
- changed = true;
- }
-
- break;
-
- case RGB_GREEN:
- if (menu_event->iptkey == IPT_UI_LEFT && m_color->g() > 1)
- {
- m_color->set_g(m_color->g() - 1);
- changed = true;
- }
-
- else if (menu_event->iptkey == IPT_UI_RIGHT && m_color->g() < 255)
- {
- m_color->set_g(m_color->g() + 1);
- changed = true;
- }
-
- else if (menu_event->iptkey == IPT_UI_SELECT || menu_event->iptkey == IPT_SPECIAL)
- {
- inkey_special(menu_event);
- changed = true;
- }
-
- break;
-
- case RGB_BLUE:
- if (menu_event->iptkey == IPT_UI_LEFT && m_color->b() > 1)
- {
- m_color->set_b(m_color->b() - 1);
- changed = true;
- }
-
- else if (menu_event->iptkey == IPT_UI_RIGHT && m_color->b() < 255)
- {
- m_color->set_b(m_color->b() + 1);
- changed = true;
- }
-
- else if (menu_event->iptkey == IPT_UI_SELECT || menu_event->iptkey == IPT_SPECIAL)
+ case IPT_UI_LEFT:
+ case IPT_UI_RIGHT:
+ {
+ int updated = (IPT_UI_LEFT == menu_event->iptkey) ? -1 : 1;
+ switch (uintptr_t(menu_event->itemref))
{
- inkey_special(menu_event);
- changed = true;
+ case RGB_ALPHA:
+ updated += m_color->a();
+ if ((0 <= updated) && (255 >= updated))
+ {
+ m_color->set_a(updated);
+ changed = true;
+ }
+ break;
+ case RGB_RED:
+ updated += m_color->r();
+ if ((0 <= updated) && (255 >= updated))
+ {
+ m_color->set_r(updated);
+ changed = true;
+ }
+ break;
+ case RGB_GREEN:
+ updated += m_color->g();
+ if ((0 <= updated) && (255 >= updated))
+ {
+ m_color->set_g(updated);
+ changed = true;
+ }
+ break;
+ case RGB_BLUE:
+ updated += m_color->b();
+ if ((0 <= updated) && (255 >= updated))
+ {
+ m_color->set_b(updated);
+ changed = true;
+ }
+ break;
}
+ }
+ break;
- break;
-
- case PALETTE_CHOOSE:
- if (menu_event->iptkey == IPT_UI_SELECT)
- menu::stack_push<menu_palette_sel>(ui(), container(), *m_color);
- break;
+ case IPT_UI_SELECT:
+ case IPT_SPECIAL:
+ inkey_special(menu_event);
+ changed = true;
+ break;
}
- }
- if (changed)
- reset(reset_options::REMEMBER_REF);
+ if (changed)
+ reset(reset_options::REMEMBER_REF);
+ }
}
//-------------------------------------------------
@@ -940,12 +898,21 @@ void menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, floa
y1 += ui().box_tb_border();
// draw the text within it
- ui().draw_text_full(container(), m_title, 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());
-
- std::string sampletxt(_("Color preview ="));
- ui().draw_text_full(container(), sampletxt, 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);
+ ui().draw_text_full(
+ container(),
+ m_title,
+ 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());
+
+ std::string sampletxt(_("Color preview:"));
+ ui().draw_text_full(
+ container(),
+ sampletxt,
+ 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);
width += 2 * lr_border;
maxwidth = std::max(origx2 - origx1, width);
@@ -955,22 +922,28 @@ void menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, floa
y1 = origy2 + ui().box_tb_border();
y2 = origy2 + bottom;
- // draw a box
- ui().draw_outlined_box(container(), x1, y1, x1 + width, y2, UI_RED_COLOR);
+ // draw a box - force black to ensure the text is legible
+ ui().draw_outlined_box(container(), x1, y1, x2, y2, rgb_t::black());
// take off the borders
x1 += lr_border;
y1 += ui().box_tb_border();
- // draw the normal text
- ui().draw_text_full(container(), sampletxt, x1, y1, width - lr_border, ui::text_layout::CENTER, ui::text_layout::NEVER,
- mame_ui_manager::NORMAL, rgb_t::white(), rgb_t::black());
+ // draw the text label - force white to ensure it's legible
+ ui().draw_text_full(
+ container(),
+ sampletxt,
+ x1, y1, width - lr_border,
+ ui::text_layout::CENTER, ui::text_layout::NEVER,
+ mame_ui_manager::NORMAL, rgb_t::white(), rgb_t::black());
- x1 += width + lr_border;
- y1 -= ui().box_tb_border();
+ x1 += width + (lr_border * 2.0f);
+ x2 -= lr_border;
+ y2 -= ui().box_tb_border();
- // draw color box
- ui().draw_outlined_box(container(), x1, y1, x2, y2, *m_color);
+ // add white under half the sample swatch to make alpha effects visible
+ container().add_rect((x1 + x2) * 0.5f, y1, x2, y2, rgb_t::white(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+ container().add_rect(x1, y1, x2, y2, *m_color, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
//-------------------------------------------------
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;
+ }
}
//-------------------------------------------------
diff --git a/src/frontend/mame/ui/datmenu.h b/src/frontend/mame/ui/datmenu.h
index 3dc60b16c93..0c7fd9c22e7 100644
--- a/src/frontend/mame/ui/datmenu.h
+++ b/src/frontend/mame/ui/datmenu.h
@@ -37,6 +37,7 @@ public:
protected:
virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
+ virtual bool custom_mouse_down() override;
private:
// draw dats menu
diff --git a/src/frontend/mame/ui/dirmenu.cpp b/src/frontend/mame/ui/dirmenu.cpp
index 85ca2fc085b..1fe6682b123 100644
--- a/src/frontend/mame/ui/dirmenu.cpp
+++ b/src/frontend/mame/ui/dirmenu.cpp
@@ -434,7 +434,7 @@ void menu_add_change_folder::custom_render(void *selectedref, float top, float b
std::begin(bottomtext), std::end(bottomtext),
origx1, origx2, origy2 + ui().box_tb_border(), origy2 + bottom,
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false,
- ui().colors().text_color(), UI_RED_COLOR, 1.0f);
+ ui().colors().text_color(), ui().colors().background_color(), 1.0f);
}
/**************************************************
diff --git a/src/frontend/mame/ui/selector.cpp b/src/frontend/mame/ui/selector.cpp
index 24de93987c8..96657541e44 100644
--- a/src/frontend/mame/ui/selector.cpp
+++ b/src/frontend/mame/ui/selector.cpp
@@ -128,7 +128,7 @@ void menu_selector::custom_render(void *selectedref, float top, float bottom, fl
std::begin(tempbuf), std::end(tempbuf),
origx1, origx2, origy2 + ui().box_tb_border(), origy2 + bottom,
ui::text_layout::CENTER, ui::text_layout::NEVER, false,
- ui().colors().text_color(), UI_RED_COLOR, 1.0f);
+ ui().colors().text_color(), ui().colors().background_color(), 1.0f);
}
//-------------------------------------------------
diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp
index 4aa29bca89f..f755fd1d4e2 100644
--- a/src/frontend/mame/ui/selmenu.cpp
+++ b/src/frontend/mame/ui/selmenu.cpp
@@ -1799,12 +1799,6 @@ void menu_select_launch::handle_events(uint32_t flags, event &ev)
set_selected_index(hover());
ev.iptkey = IPT_UI_SELECT;
}
-
- if (is_last_selected())
- {
- ev.iptkey = IPT_UI_CANCEL;
- stack_pop();
- }
stop = true;
break;
diff --git a/src/frontend/mame/ui/submenu.cpp b/src/frontend/mame/ui/submenu.cpp
index 5e6e0cc4152..d6d237cabd3 100644
--- a/src/frontend/mame/ui/submenu.cpp
+++ b/src/frontend/mame/ui/submenu.cpp
@@ -456,7 +456,7 @@ void submenu::custom_render(void *selectedref, float top, float bottom, float or
std::begin(bottomtext), std::end(bottomtext),
origx1, origx2, origy2 + ui().box_tb_border(), origy2 + bottom,
ui::text_layout::CENTER, ui::text_layout::TRUNCATE, false,
- ui().colors().text_color(), UI_RED_COLOR, 1.0f);
+ ui().colors().text_color(), ui().colors().background_color(), 1.0f);
}
}
}
diff --git a/src/frontend/mame/ui/toolbar.ipp b/src/frontend/mame/ui/toolbar.ipp
index 40400ea3feb..daecebddd12 100644
--- a/src/frontend/mame/ui/toolbar.ipp
+++ b/src/frontend/mame/ui/toolbar.ipp
@@ -37,21 +37,21 @@ char const *const toolbar_icons_svg[] = {
// info
u8"<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg' version='1.1' height='100' width='100'>"
- "<circle cx='50' cy='50' r='47' fill='#001fff' stroke='#3f56ff' stroke-width='6' />"
+ "<circle cx='50' cy='50' r='47' fill='#001fff' stroke='#3f56ff' stroke-width='6' stroke-opacity='0.8' />"
"<circle cx='50' cy='20' r='10' fill='#ffffff' />"
"<path fill='#ffffff' d='m 59,38 v 34 a 10,4 0 0,0 10,4 v 8 h -36 v -8 a 10,4 0 0,0 10,-4 v -23 a 8,4 0 0,0 -8,-4 v -6 z' />"
"</svg>",
// previous menu
u8"<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg' version='1.1' height='100' width='100'>"
- "<rect y='8' x='8' height='84' width='84' fill='#001bdf' stroke='#001bdf' stroke-width='16' stroke-linejoin='round' />"
+ "<rect y='8' x='8' height='84' width='84' fill='#3f56ff' stroke='#3f56ff' stroke-width='16' stroke-opacity='0.8' stroke-linejoin='round' />"
"<rect y='10' x='10' height='80' width='80' fill='#001fff' stroke='#001fff' stroke-width='8' stroke-linejoin='round' />"
"<path fill='#ffffff' stroke='#ffffff' stroke-width='8' stroke-linejoin='round' d='m 16,46 28,-28 v 16 q 40,12 40,48 q -10,-24 -40,-24 v 16 z' />"
"</svg>",
// exit
u8"<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg' version='1.1' height='100' width='100'>"
- "<rect y='8' x='8' height='84' width='84' fill='#df0000' stroke='#df0000' stroke-width='16' stroke-linejoin='round' />"
+ "<rect y='8' x='8' height='84' width='84' fill='#ff3f3f' fill-opacity='0.8' stroke='#ff3f3f' stroke-opacity='0.8' stroke-width='16' stroke-linejoin='round' />"
"<rect y='10' x='10' height='80' width='80' fill='#ff0000' stroke='#ff0000' stroke-width='8' stroke-linejoin='round' />"
"<path fill='#ffffff' stroke='#ffffff' stroke-width='8' stroke-linejoin='round' d='m 16,24 8,-8 26,26 26,-26 8,8 -26,26 26,26 -8,8 -26,-26 -26,26 -8,-8 26,-26 z' />"
"</svg>" };
diff --git a/src/frontend/mame/ui/ui.h b/src/frontend/mame/ui/ui.h
index 633d3c476f4..9607ca24a91 100644
--- a/src/frontend/mame/ui/ui.h
+++ b/src/frontend/mame/ui/ui.h
@@ -54,9 +54,9 @@ class laserdisc_device;
#define UI_LINE_WIDTH (1.0f / 500.0f)
/* handy colors */
-#define UI_GREEN_COLOR rgb_t(0xef,0x10,0x60,0x10)
-#define UI_YELLOW_COLOR rgb_t(0xef,0x60,0x60,0x10)
-#define UI_RED_COLOR rgb_t(0xf0,0x60,0x10,0x10)
+#define UI_GREEN_COLOR rgb_t(0xef,0x0a,0x66,0x0a)
+#define UI_YELLOW_COLOR rgb_t(0xef,0xcc,0x7a,0x28)
+#define UI_RED_COLOR rgb_t(0xef,0xcc,0x14,0x14)
/* cancel return value for a UI handler */
#define UI_HANDLER_CANCEL ((uint32_t)~0)