summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/ui/ui.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/ui/ui.h')
-rw-r--r--src/emu/ui/ui.h227
1 files changed, 126 insertions, 101 deletions
diff --git a/src/emu/ui/ui.h b/src/emu/ui/ui.h
index ac68a2fb773..31f52b46134 100644
--- a/src/emu/ui/ui.h
+++ b/src/emu/ui/ui.h
@@ -14,14 +14,15 @@
#define __USRINTRF_H__
#include "render.h"
-
+#include "moptions.h"
/***************************************************************************
CONSTANTS
***************************************************************************/
/* preferred font height; use ui_get_line_height() to get actual height */
-#define UI_TARGET_FONT_ROWS (25)
+#define UI_TARGET_FONT_ROWS get_font_rows()
+
#define UI_TARGET_FONT_HEIGHT (1.0f / (float)UI_TARGET_FONT_ROWS)
#define UI_MAX_FONT_HEIGHT (1.0f / 15.0f)
@@ -35,25 +36,25 @@
/* handy colors */
#define ARGB_WHITE rgb_t(0xff,0xff,0xff,0xff)
#define ARGB_BLACK rgb_t(0xff,0x00,0x00,0x00)
-#define UI_BORDER_COLOR rgb_t(0xff,0xff,0xff,0xff)
-#define UI_BACKGROUND_COLOR rgb_t(0xef,0x10,0x10,0x30)
-#define UI_GFXVIEWER_BG_COLOR rgb_t(0xef,0x10,0x10,0x30)
#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_UNAVAILABLE_COLOR rgb_t(0xff,0x40,0x40,0x40)
-#define UI_TEXT_COLOR rgb_t(0xff,0xff,0xff,0xff)
-#define UI_TEXT_BG_COLOR rgb_t(0xef,0x00,0x00,0x00)
-#define UI_SUBITEM_COLOR rgb_t(0xff,0xff,0xff,0xff)
-#define UI_CLONE_COLOR rgb_t(0xff,0x80,0x80,0x80)
-#define UI_SELECTED_COLOR rgb_t(0xff,0xff,0xff,0x00)
-#define UI_SELECTED_BG_COLOR rgb_t(0xef,0x80,0x80,0x00)
-#define UI_MOUSEOVER_COLOR rgb_t(0xff,0xff,0xff,0x80)
-#define UI_MOUSEOVER_BG_COLOR rgb_t(0x70,0x40,0x40,0x00)
-#define UI_MOUSEDOWN_COLOR rgb_t(0xff,0xff,0xff,0x80)
-#define UI_MOUSEDOWN_BG_COLOR rgb_t(0xb0,0x60,0x60,0x00)
-#define UI_DIPSW_COLOR rgb_t(0xff,0xff,0xff,0x00)
-#define UI_SLIDER_COLOR rgb_t(0xff,0xff,0xff,0xff)
+#define UI_BORDER_COLOR decode_ui_color(0)
+#define UI_BACKGROUND_COLOR decode_ui_color(1)
+#define UI_GFXVIEWER_BG_COLOR decode_ui_color(2)
+#define UI_UNAVAILABLE_COLOR decode_ui_color(3)
+#define UI_TEXT_COLOR decode_ui_color(4)
+#define UI_TEXT_BG_COLOR decode_ui_color(5)
+#define UI_SUBITEM_COLOR decode_ui_color(6)
+#define UI_CLONE_COLOR decode_ui_color(7)
+#define UI_SELECTED_COLOR decode_ui_color(8)
+#define UI_SELECTED_BG_COLOR decode_ui_color(9)
+#define UI_MOUSEOVER_COLOR decode_ui_color(10)
+#define UI_MOUSEOVER_BG_COLOR decode_ui_color(11)
+#define UI_MOUSEDOWN_COLOR decode_ui_color(12)
+#define UI_MOUSEDOWN_BG_COLOR decode_ui_color(13)
+#define UI_DIPSW_COLOR decode_ui_color(14)
+#define UI_SLIDER_COLOR decode_ui_color(15)
/* cancel return value for a UI handler */
#define UI_HANDLER_CANCEL ((UINT32)~0)
@@ -84,7 +85,10 @@ enum
#define SLIDER_NOCHANGE 0x12345678
-
+/***************************************************************************
+ FOR FUTURE LOCALIZATION
+***************************************************************************/
+#define _(param) param
/***************************************************************************
TYPE DEFINITIONS
@@ -112,96 +116,117 @@ struct slider_state
class ui_manager
{
public:
- // construction/destruction
- ui_manager(running_machine &machine);
-
- // getters
- running_machine &machine() const { return m_machine; }
- bool single_step() const { return m_single_step; }
-
- // setters
- void set_single_step(bool single_step) { m_single_step = single_step; }
-
- // methods
- void initialize(running_machine &machine);
- UINT32 set_handler(ui_callback callback, UINT32 param);
- void display_startup_screens(bool first_time, bool show_disclaimer);
- void set_startup_text(const char *text, bool force);
- void update_and_render(render_container *container);
- render_font *get_font();
- float get_line_height();
- float get_char_width(unicode_char ch);
- float get_string_width(const char *s);
- void draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor);
- void draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t fgcolor, rgb_t bgcolor);
- void draw_text(render_container *container, const char *buf, float x, float y);
- void 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 = nullptr, float *totalheight = nullptr);
+ // construction/destruction
+ ui_manager(running_machine &machine);
+
+ void init();
+
+ // getters
+ running_machine &machine() const { return m_machine; }
+ bool single_step() const { return m_single_step; }
+ ui_options &options() { return m_ui_options; }
+
+ // setters
+ void set_single_step(bool single_step) { m_single_step = single_step; }
+
+ // methods
+ void initialize(running_machine &machine);
+ UINT32 set_handler(ui_callback callback, UINT32 param);
+ void display_startup_screens(bool first_time, bool show_disclaimer);
+ void set_startup_text(const char *text, bool force);
+ void update_and_render(render_container *container);
+ render_font *get_font();
+ float get_line_height();
+ float get_char_width(unicode_char ch);
+ float get_string_width(const char *s);
+ void draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor);
+ void draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t fgcolor, rgb_t bgcolor);
+ void draw_text(render_container *container, const char *buf, float x, float y);
+ void 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 = nullptr, float *totalheight = nullptr, float text_size = 1.0f);
void draw_text_box(render_container *container, const char *text, int justify, float xpos, float ypos, rgb_t backcolor);
- void draw_message_window(render_container *container, const char *text);
-
- void CLIB_DECL popup_time(int seconds, const char *text, ...) ATTR_PRINTF(3,4);
- void show_fps_temp(double seconds);
- void set_show_fps(bool show);
- bool show_fps() const;
- bool show_fps_counter();
- void set_show_profiler(bool show);
- bool show_profiler() const;
- void show_menu();
- void show_mouse(bool status);
- bool is_menu_active();
- bool can_paste();
- void paste();
- bool use_natural_keyboard() const;
- void set_use_natural_keyboard(bool use_natural_keyboard);
- void image_handler_ingame();
- void increase_frameskip();
- void decrease_frameskip();
- void request_quit();
-
- // print the game info string into a buffer
- std::string &game_info_astring(std::string &str);
-
- // slider controls
- const slider_state *get_slider_list(void);
-
- // other
- void process_natural_keyboard();
+ void draw_message_window(render_container *container, const char *text);
+
+ void CLIB_DECL popup_time(int seconds, const char *text, ...) ATTR_PRINTF(3,4);
+ void show_fps_temp(double seconds);
+ void set_show_fps(bool show);
+ bool show_fps() const;
+ bool show_fps_counter();
+ void set_show_profiler(bool show);
+ bool show_profiler() const;
+ void show_menu();
+ void show_mouse(bool status);
+ bool is_menu_active();
+ bool can_paste();
+ void paste();
+ bool use_natural_keyboard() const;
+ void set_use_natural_keyboard(bool use_natural_keyboard);
+ void image_handler_ingame();
+ void increase_frameskip();
+ void decrease_frameskip();
+ void request_quit();
+
+ // print the game info string into a buffer
+ std::string &game_info_astring(std::string &str);
+
+ // slider controls
+ const slider_state *get_slider_list(void);
+
+ // other
+ void process_natural_keyboard();
+
+ void set_show_timecode_counter(bool value) { m_show_timecode_counter = value; m_show_timecode_total = true; }
+ bool show_timecode_counter();
+ bool show_timecode_total();
+
+ // word wrap
+ int wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, std::vector<int> &xstart, std::vector<int> &xend, float text_size = 1.0f);
+
+ // draw an outlined box with given line color and filled with a texture
+ void draw_textured_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor, rgb_t linecolor, render_texture *texture = nullptr, UINT32 flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
+
+ // return text string width with given text size
+ float get_string_width_ex(const char *s, float text_size);
private:
- // instance variables
- running_machine & m_machine;
- render_font * m_font;
- ui_callback m_handler_callback;
- UINT32 m_handler_param;
- bool m_single_step;
- bool m_showfps;
- osd_ticks_t m_showfps_end;
- bool m_show_profiler;
- osd_ticks_t m_popup_text_end;
- bool m_use_natural_keyboard;
+ // instance variables
+ running_machine & m_machine;
+ render_font * m_font;
+ ui_callback m_handler_callback;
+ UINT32 m_handler_param;
+ bool m_single_step;
+ bool m_showfps;
+ osd_ticks_t m_showfps_end;
+ bool m_show_profiler;
+ osd_ticks_t m_popup_text_end;
+ bool m_use_natural_keyboard;
std::unique_ptr<UINT8[]> m_non_char_keys_down;
- render_texture * m_mouse_arrow_texture;
- bool m_mouse_show;
-
- // text generators
- std::string &disclaimer_string(std::string &buffer);
- std::string &warnings_string(std::string &buffer);
-
- // UI handlers
- static UINT32 handler_messagebox(running_machine &machine, render_container *container, UINT32 state);
- static UINT32 handler_messagebox_ok(running_machine &machine, render_container *container, UINT32 state);
- static UINT32 handler_messagebox_anykey(running_machine &machine, render_container *container, UINT32 state);
- static UINT32 handler_ingame(running_machine &machine, render_container *container, UINT32 state);
- static UINT32 handler_load_save(running_machine &machine, render_container *container, UINT32 state);
- static UINT32 handler_confirm_quit(running_machine &machine, render_container *container, UINT32 state);
-
- // private methods
- void exit();
+ render_texture * m_mouse_arrow_texture;
+ bool m_mouse_show;
+ bool m_show_timecode_counter;
+ bool m_show_timecode_total;
+ bool m_load_save_hold;
+ ui_options m_ui_options;
+
+ // text generators
+ std::string &disclaimer_string(std::string &buffer);
+ std::string &warnings_string(std::string &buffer);
+
+ // UI handlers
+ static UINT32 handler_messagebox(running_machine &machine, render_container *container, UINT32 state);
+ static UINT32 handler_messagebox_ok(running_machine &machine, render_container *container, UINT32 state);
+ static UINT32 handler_messagebox_anykey(running_machine &machine, render_container *container, UINT32 state);
+ static UINT32 handler_ingame(running_machine &machine, render_container *container, UINT32 state);
+ static UINT32 handler_load_save(running_machine &machine, render_container *container, UINT32 state);
+ static UINT32 handler_confirm_quit(running_machine &machine, render_container *container, UINT32 state);
+
+ // private methods
+ void exit();
};
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
-
+rgb_t decode_ui_color(int id, running_machine *machine = nullptr);
+int get_font_rows(running_machine *machine = NULL);
#endif /* __USRINTRF_H__ */