diff options
author | npwoods <npwoods@alumni.cmu.edu> | 2019-06-30 12:16:44 -0400 |
---|---|---|
committer | R. Belmont <rb6502@users.noreply.github.com> | 2019-06-30 12:16:44 -0400 |
commit | 1047b8cafeab7a32eefec524ca0621573186c125 (patch) | |
tree | 4f0db565575ce5eee913bc1cc29c4bcf2a8cd164 /src/frontend/mame/ui/menu.h | |
parent | 66939696f1e68ec35964c3577b256131603fcc8a (diff) |
Refactored UI font metrics (#5291)
* Changed the various usages of UI_*COLOR to be calls to
src/frontend/mame/ui/moptions.h
The various UI_*COLOR macros were implemented as calls to
decode_ui_color, which cached the values for the various options in a
static array, which was obviously a gross hack.
This refactoring is strategic because I am trying to confine awareness
of mame_ui_manager to code in src/frontend/mame/ui, and the
implementation of decode_ui_color() relied on the ability to access
mame_ui_manager as a singleton from outside this code.
* Created a ui_colors object, so that queries for UI RGB values would not
always require parsing strings
* Replaced UI_TARGET_FONT_[ROWS|HEIGHT] and UI_BOX_[LR|TD]_BORDER macros with
property calls
These macros were implemented with a call to a function
(get_font_rows()) that opportunistically stashed the results of option
accesses in static variables; in other words, a gross hack
Because get_font_rows() attempted to access mame_ui_manager as a
singleton, it was an obstactle to providing an alternative
implementation of ui_manager
* Remove stray debugging cruft that found a way into the other PR
Diffstat (limited to 'src/frontend/mame/ui/menu.h')
-rw-r--r-- | src/frontend/mame/ui/menu.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/frontend/mame/ui/menu.h b/src/frontend/mame/ui/menu.h index bacb4e88721..8df66a92882 100644 --- a/src/frontend/mame/ui/menu.h +++ b/src/frontend/mame/ui/menu.h @@ -222,7 +222,7 @@ protected: 0.0f, 0.0f, 1.0f, justify, wrap, mame_ui_manager::NONE, rgb_t::black(), rgb_t::white(), &width, nullptr, text_size); - width += 2.0f * UI_BOX_LR_BORDER; + width += 2.0f * ui().box_lr_border(); maxwidth = (std::max)(maxwidth, width); } if (scale && ((origx2 - origx1) < maxwidth)) @@ -237,10 +237,10 @@ protected: ui().draw_outlined_box(container(), x1, y1, x2, y2, bgcolor); // inset box and draw content - x1 += UI_BOX_LR_BORDER; - x2 -= UI_BOX_LR_BORDER; - y1 += UI_BOX_TB_BORDER; - y2 -= UI_BOX_TB_BORDER; + x1 += ui().box_lr_border(); + x2 -= ui().box_lr_border(); + y1 += ui().box_tb_border(); + y2 -= ui().box_tb_border(); for (Iter it = begin; it != end; ++it) { ui().draw_text_full( |