mirror of
https://github.com/holub/mame
synced 2025-04-26 18:23:08 +03:00
Encapsulated methods that draw UI elements like fps counter, profiler etc
This commit is contained in:
parent
c3b7a9e470
commit
bee55557f0
@ -1169,6 +1169,52 @@ void mame_ui_manager::paste()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// draw_fps_counter
|
||||
//-------------------------------------------------
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// draw_timecode_counter
|
||||
//-------------------------------------------------
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// draw_timecode_total
|
||||
//-------------------------------------------------
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// draw_profiler
|
||||
//-------------------------------------------------
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// image_handler_ingame - execute display
|
||||
// callback function for each image device
|
||||
@ -1204,31 +1250,19 @@ UINT32 mame_ui_manager::handler_ingame(render_container *container)
|
||||
|
||||
// first draw the FPS counter
|
||||
if (show_fps_counter())
|
||||
{
|
||||
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);
|
||||
}
|
||||
draw_fps_counter(container);
|
||||
|
||||
// Show the duration of current part (intro or gameplay or extra)
|
||||
if (show_timecode_counter()) {
|
||||
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);
|
||||
}
|
||||
// Show the total time elapsed for the video preview (all parts intro, gameplay, extras)
|
||||
if (show_timecode_total()) {
|
||||
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);
|
||||
}
|
||||
if (show_timecode_counter())
|
||||
draw_timecode_counter(container);
|
||||
|
||||
// Show the total time elapsed for the video preview (all parts intro, gameplay, extras)
|
||||
if (show_timecode_total())
|
||||
draw_timecode_total(container);
|
||||
|
||||
// draw the profiler if visible
|
||||
if (show_profiler())
|
||||
{
|
||||
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_profiler(container);
|
||||
|
||||
// if we're single-stepping, pause now
|
||||
if (single_step())
|
||||
|
@ -248,6 +248,10 @@ public:
|
||||
void increase_frameskip();
|
||||
void decrease_frameskip();
|
||||
void request_quit();
|
||||
void draw_fps_counter(render_container *container);
|
||||
void draw_timecode_counter(render_container *container);
|
||||
void draw_timecode_total(render_container *container);
|
||||
void draw_profiler(render_container *container);
|
||||
|
||||
// print the game info string into a buffer
|
||||
std::string &game_info_astring(std::string &str);
|
||||
|
Loading…
Reference in New Issue
Block a user