diff options
author | Vas Crabb <vas@vastheman.com> | 2021-11-10 00:24:21 +1100 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2021-11-10 00:24:21 +1100 |
commit | 39bd1e3558a3c01c83e20fdcf7b42108b61c4f32 (patch) | |
tree | 9886fab93ad34c0233e1d6c59bcd32da99809847 /src/frontend | |
parent | 98ec00423d3f1d6ff1cd0d537762ba42d625c5e5 (diff) |
-stv.cpp: Removed most run time I/O port lookups and removed PORT_RESET.
* IOGA port G counter reset is emulated correctly now.
* Increased sensitivity for patocar trackball – it seemed too slow with
mouse or analog stick.
-frontend: Handle analog controls with high sensitivity numbers better.
-arcadia.cpp: Removed commented PORT_RESET - it makes no sense for
joysticks anyway.
Diffstat (limited to 'src/frontend')
-rw-r--r-- | src/frontend/mame/ui/analogipt.cpp | 11 | ||||
-rw-r--r-- | src/frontend/mame/ui/analogipt.h | 2 | ||||
-rw-r--r-- | src/frontend/mame/ui/menu.h | 14 | ||||
-rw-r--r-- | src/frontend/mame/ui/miscmenu.cpp | 1 |
4 files changed, 12 insertions, 16 deletions
diff --git a/src/frontend/mame/ui/analogipt.cpp b/src/frontend/mame/ui/analogipt.cpp index f415b0e4d65..20791328392 100644 --- a/src/frontend/mame/ui/analogipt.cpp +++ b/src/frontend/mame/ui/analogipt.cpp @@ -22,15 +22,15 @@ namespace ui { inline menu_analog::item_data::item_data(ioport_field &f, int t) noexcept : field(f) , type(t) - , min((ANALOG_ITEM_SENSITIVITY == t) ? 1 : 0) - , max((ANALOG_ITEM_REVERSE == t) ? 1 : 255) - , cur(-1) , defvalue( (ANALOG_ITEM_KEYSPEED == t) ? f.delta() : (ANALOG_ITEM_CENTERSPEED == t) ? f.centerdelta() : (ANALOG_ITEM_REVERSE == t) ? f.analog_reverse() : (ANALOG_ITEM_SENSITIVITY == t) ? f.sensitivity() : -1) + , min((ANALOG_ITEM_SENSITIVITY == t) ? 1 : 0) + , max((ANALOG_ITEM_REVERSE == t) ? 1 : std::max(defvalue * 4, 255)) + , cur(-1) { } @@ -296,10 +296,7 @@ void menu_analog::handle(event const *ev) } // clamp to range - if (newval < data.min) - newval = data.min; - if (newval > data.max) - newval = data.max; + newval = std::clamp(newval, data.min, data.max); // if things changed, update if (newval != data.cur) diff --git a/src/frontend/mame/ui/analogipt.h b/src/frontend/mame/ui/analogipt.h index b4baa6bfa88..fbc9907a0df 100644 --- a/src/frontend/mame/ui/analogipt.h +++ b/src/frontend/mame/ui/analogipt.h @@ -45,9 +45,9 @@ private: std::reference_wrapper<ioport_field> field; int type; + int defvalue; int min, max; int cur; - int defvalue; }; struct field_data diff --git a/src/frontend/mame/ui/menu.h b/src/frontend/mame/ui/menu.h index 6c5238eacef..e5904f2f347 100644 --- a/src/frontend/mame/ui/menu.h +++ b/src/frontend/mame/ui/menu.h @@ -207,13 +207,13 @@ protected: float maxwidth(origwidth); for (Iter it = begin; it != end; ++it) { - float width; - ui().draw_text_full( - container(), std::string_view(*it), - 0.0f, 0.0f, 1.0f, justify, wrap, - mame_ui_manager::NONE, rgb_t::black(), rgb_t::white(), - &width, nullptr, text_size); - maxwidth = (std::max)(maxwidth, width); + std::string_view const &line(*it); + if (!line.empty()) + { + auto layout = ui().create_layout(container(), 1.0f, justify, wrap); + layout.add_text(std::string_view(*it), rgb_t::white(), rgb_t::black(), text_size); + maxwidth = (std::max)(layout.actual_width(), maxwidth); + } } if (scale && (origwidth < maxwidth)) { diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp index 8c70dce18ad..0d052562fa0 100644 --- a/src/frontend/mame/ui/miscmenu.cpp +++ b/src/frontend/mame/ui/miscmenu.cpp @@ -730,7 +730,6 @@ menu_machine_configure::~menu_machine_configure() void menu_machine_configure::handle(event const *ev) { // process the menu - //process_parent(); FIXME: drawn in the wrong order, can't see menu if (ev && ev->itemref) { if (ev->iptkey == IPT_UI_SELECT) |