summaryrefslogtreecommitdiffstats
path: root/src/frontend/mame/ui/ui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/mame/ui/ui.cpp')
-rw-r--r--src/frontend/mame/ui/ui.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index 1213db4aa6d..28e065dcf8c 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -401,7 +401,7 @@ void mame_ui_manager::update_and_render(render_container *container)
// display any popup messages
if (osd_ticks() < m_popup_text_end)
- draw_text_box(container, messagebox_poptext.c_str(), JUSTIFY_CENTER, 0.5f, 0.9f, messagebox_backcolor);
+ draw_text_box(container, messagebox_poptext.c_str(), ui::text_layout::CENTER, 0.5f, 0.9f, messagebox_backcolor);
else
m_popup_text_end = 0;
@@ -543,7 +543,7 @@ void mame_ui_manager::draw_outlined_box(render_container *container, float x0, f
void mame_ui_manager::draw_text(render_container *container, const char *buf, float x, float y)
{
- draw_text_full(container, buf, x, y, 1.0f - x, JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
+ draw_text_full(container, buf, x, y, 1.0f - x, ui::text_layout::LEFT, ui::text_layout::WORD, mame_ui_manager::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
@@ -553,20 +553,20 @@ void mame_ui_manager::draw_text(render_container *container, const char *buf, fl
// and full size computation
//-------------------------------------------------
-void mame_ui_manager::draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight, float text_size)
+void mame_ui_manager::draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, ui::text_layout::text_justify justify, ui::text_layout::word_wrapping wrap, draw_mode draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight, float text_size)
{
// create the layout
- auto layout = create_layout(container, origwrapwidth, (ui::text_layout::text_justify)justify, (ui::text_layout::word_wrapping)wrap);
+ auto layout = create_layout(container, origwrapwidth, justify, wrap);
// append text to it
layout.add_text(
origs,
fgcolor,
- draw == DRAW_OPAQUE ? bgcolor : rgb_t(0, 0, 0, 0),
+ draw == OPAQUE ? bgcolor : rgb_t(0, 0, 0, 0),
text_size);
// and emit it (if we are asked to do so)
- if (draw != DRAW_NONE)
+ if (draw != NONE)
layout.emit(container, x, y);
// return width/height
@@ -582,7 +582,7 @@ void mame_ui_manager::draw_text_full(render_container *container, const char *or
// message with a box around it
//-------------------------------------------------
-void mame_ui_manager::draw_text_box(render_container *container, const char *text, int justify, float xpos, float ypos, rgb_t backcolor)
+void mame_ui_manager::draw_text_box(render_container *container, const char *text, ui::text_layout::text_justify justify, float xpos, float ypos, rgb_t backcolor)
{
float line_height = get_line_height();
float max_width = 2.0f * ((xpos <= 0.5f) ? xpos : 1.0f - xpos) - 2.0f * UI_BOX_LR_BORDER;
@@ -610,7 +610,7 @@ void mame_ui_manager::draw_text_box(render_container *container, const char *tex
// compute the multi-line target width/height
draw_text_full(container, text, target_x, target_y, target_width + 0.00001f,
- justify, WRAP_WORD, DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &target_width, &target_height);
+ justify, ui::text_layout::word_wrapping::WORD, draw_mode::NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &target_width, &target_height);
if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER)
target_height = floorf((1.0f - 2.0f * UI_BOX_TB_BORDER) / line_height) * line_height;
@@ -626,7 +626,7 @@ void mame_ui_manager::draw_text_box(render_container *container, const char *tex
target_x + target_width + UI_BOX_LR_BORDER,
target_y + target_height + UI_BOX_TB_BORDER, backcolor);
draw_text_full(container, text, target_x, target_y, target_width + 0.00001f,
- justify, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
+ justify, ui::text_layout::word_wrapping::WORD, draw_mode::NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr);
}
@@ -637,7 +637,7 @@ void mame_ui_manager::draw_text_box(render_container *container, const char *tex
void mame_ui_manager::draw_message_window(render_container *container, const char *text)
{
- draw_text_box(container, text, JUSTIFY_LEFT, 0.5f, 0.5f, UI_BACKGROUND_COLOR);
+ draw_text_box(container, text, ui::text_layout::text_justify::LEFT, 0.5f, 0.5f, UI_BACKGROUND_COLOR);
}
@@ -1010,7 +1010,7 @@ std::string &mame_ui_manager::game_info_astring(std::string &str)
UINT32 mame_ui_manager::handler_messagebox(render_container *container)
{
- draw_text_box(container, messagebox_text.c_str(), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
+ draw_text_box(container, messagebox_text.c_str(), ui::text_layout::LEFT, 0.5f, 0.5f, messagebox_backcolor);
return 0;
}
@@ -1026,7 +1026,7 @@ UINT32 mame_ui_manager::handler_messagebox_anykey(render_container *container)
UINT32 state = 0;
// draw a standard message window
- draw_text_box(container, messagebox_text.c_str(), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
+ draw_text_box(container, messagebox_text.c_str(), ui::text_layout::LEFT, 0.5f, 0.5f, messagebox_backcolor);
// if the user cancels, exit out completely
if (machine().ui_input().pressed(IPT_UI_CANCEL))
@@ -1176,7 +1176,7 @@ void mame_ui_manager::paste()
void mame_ui_manager::draw_fps_counter(render_container *container)
{
draw_text_full(container, machine().video().speed_text().c_str(), 0.0f, 0.0f, 1.0f,
- JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, rgb_t::white, rgb_t::black, nullptr, nullptr);
+ ui::text_layout::RIGHT, ui::text_layout::WORD, OPAQUE, rgb_t::white, rgb_t::black, nullptr, nullptr);
}
@@ -1188,7 +1188,7 @@ void mame_ui_manager::draw_timecode_counter(render_container *container)
{
std::string tempstring;
draw_text_full(container, machine().video().timecode_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f,
- JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, rgb_t(0xf0, 0xf0, 0x10, 0x10), rgb_t::black, nullptr, nullptr);
+ ui::text_layout::RIGHT, ui::text_layout::WORD, OPAQUE, rgb_t(0xf0, 0xf0, 0x10, 0x10), rgb_t::black, nullptr, nullptr);
}
@@ -1200,7 +1200,7 @@ void mame_ui_manager::draw_timecode_total(render_container *container)
{
std::string tempstring;
draw_text_full(container, machine().video().timecode_total_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f,
- JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, rgb_t(0xf0, 0x10, 0xf0, 0x10), rgb_t::black, nullptr, nullptr);
+ ui::text_layout::LEFT, ui::text_layout::WORD, OPAQUE, rgb_t(0xf0, 0x10, 0xf0, 0x10), rgb_t::black, nullptr, nullptr);
}
@@ -1211,7 +1211,7 @@ void mame_ui_manager::draw_timecode_total(render_container *container)
void mame_ui_manager::draw_profiler(render_container *container)
{
const char *text = g_profiler.text(machine());
- draw_text_full(container, text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, rgb_t::white, rgb_t::black, nullptr, nullptr);
+ draw_text_full(container, text, 0.0f, 0.0f, 1.0f, ui::text_layout::LEFT, ui::text_layout::WORD, OPAQUE, rgb_t::white, rgb_t::black, nullptr, nullptr);
}
@@ -1234,7 +1234,7 @@ void mame_ui_manager::image_handler_ingame()
y = 0.5f + idx;
y *= get_line_height() + 2.0f * UI_BOX_TB_BORDER;
- draw_text_box(&machine().render().ui_container(), str.c_str(), JUSTIFY_LEFT, x, y, UI_BACKGROUND_COLOR);
+ draw_text_box(&machine().render().ui_container(), str.c_str(), ui::text_layout::LEFT, x, y, UI_BACKGROUND_COLOR);
}
}
}
@@ -1609,7 +1609,7 @@ UINT32 mame_ui_manager::handler_confirm_quit(render_container *container)
ui_select_text,
ui_cancel_text);
- draw_text_box(container, quit_message.c_str(), JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR);
+ draw_text_box(container, quit_message.c_str(), ui::text_layout::CENTER, 0.5f, 0.5f, UI_RED_COLOR);
machine().pause();
// if the user press ENTER, quit the game