From bc0146c2038c46f789a246d5616afd7c425157f3 Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 14 Feb 2021 11:05:57 -0500 Subject: Eliminate ARRAY_LENGTH template in favor of C++17's std::size * osdcomm.h: Move definition of EQUIVALENT_ARRAY to coretmpl.h * sharc.cpp, gt64xxx.cpp, ym2413.cpp, gb_lcd.cpp, snes_ppu.cpp: Use STRUCT_MEMBER for save state registration * gio/newport.cpp, megadrive/svp.cpp, nes_ctrl/bcbattle.cpp, arm7.cpp, tms9995.cpp, pckeybrd.cpp, sa1110.cpp, sa1111.cpp, jangou_blitter.cpp, vic4567.cpp: Use std::fill(_n) instead of memset * emucore.h: Remove obsolete typedef --- src/frontend/mame/ui/ui.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/frontend/mame/ui/ui.cpp') diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp index f13d8ea846b..f5e04284cd7 100644 --- a/src/frontend/mame/ui/ui.cpp +++ b/src/frontend/mame/ui/ui.cpp @@ -210,7 +210,7 @@ void mame_ui_manager::init() draw_text_box(container, messagebox_text, ui::text_layout::LEFT, 0.5f, 0.5f, colors().background_color()); return 0; }); - m_non_char_keys_down = std::make_unique((ARRAY_LENGTH(non_char_keys) + 7) / 8); + m_non_char_keys_down = std::make_unique((std::size(non_char_keys) + 7) / 8); m_mouse_show = machine().system().flags & machine_flags::CLICKABLE_ARTWORK ? true : false; // request notification callbacks @@ -981,11 +981,6 @@ bool mame_ui_manager::is_menu_active(void) void mame_ui_manager::process_natural_keyboard() { ui_event event; - int i, pressed; - input_item_id itemid; - input_code code; - uint8_t *key_down_ptr; - uint8_t key_down_mask; // loop while we have interesting events while (machine().ui_input().pop_event(&event)) @@ -996,18 +991,18 @@ void mame_ui_manager::process_natural_keyboard() } // process natural keyboard keys that don't get UI_EVENT_CHARs - for (i = 0; i < ARRAY_LENGTH(non_char_keys); i++) + for (int i = 0; i < std::size(non_char_keys); i++) { // identify this keycode - itemid = non_char_keys[i]; - code = machine().input().code_from_itemid(itemid); + input_item_id itemid = non_char_keys[i]; + input_code code = machine().input().code_from_itemid(itemid); // ...and determine if it is pressed - pressed = machine().input().code_pressed(code); + bool pressed = machine().input().code_pressed(code); // figure out whey we are in the key_down map - key_down_ptr = &m_non_char_keys_down[i / 8]; - key_down_mask = 1 << (i % 8); + uint8_t *key_down_ptr = &m_non_char_keys_down[i / 8]; + uint8_t key_down_mask = 1 << (i % 8); if (pressed && !(*key_down_ptr & key_down_mask)) { -- cgit v1.2.3