diff options
author | 2016-01-10 20:32:30 +0100 | |
---|---|---|
committer | 2016-01-10 20:32:30 +0100 | |
commit | 30c10f6f7949c0a0698cec3a5838a8ee19d98fc3 (patch) | |
tree | 316f730ea37d3c84229109fb72ad3979f98acaae /src/emu/ui/ui.cpp | |
parent | 2e5f16013ceeba6f22657208c64d85562de39733 (diff) |
modernized ui_input_manager (nw)
Diffstat (limited to 'src/emu/ui/ui.cpp')
-rw-r--r-- | src/emu/ui/ui.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 39eeb6e5edb..f6e73bd2a12 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -451,7 +451,7 @@ void ui_manager::update_and_render(render_container *container) { INT32 mouse_target_x, mouse_target_y; bool mouse_button; - render_target *mouse_target = ui_input_find_mouse(machine(), &mouse_target_x, &mouse_target_y, &mouse_button); + render_target *mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button); if (mouse_target != nullptr) { @@ -1289,15 +1289,15 @@ UINT32 ui_manager::handler_messagebox_ok(running_machine &machine, render_contai machine.ui().draw_text_box(container, messagebox_text.c_str(), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); // an 'O' or left joystick kicks us to the next state - if (state == 0 && (machine.input().code_pressed_once(KEYCODE_O) || ui_input_pressed(machine, IPT_UI_LEFT))) + if (state == 0 && (machine.input().code_pressed_once(KEYCODE_O) || machine.ui_input().pressed(IPT_UI_LEFT))) state++; // a 'K' or right joystick exits the state - else if (state == 1 && (machine.input().code_pressed_once(KEYCODE_K) || ui_input_pressed(machine, IPT_UI_RIGHT))) + else if (state == 1 && (machine.input().code_pressed_once(KEYCODE_K) || machine.ui_input().pressed(IPT_UI_RIGHT))) state = UI_HANDLER_CANCEL; // if the user cancels, exit out completely - else if (ui_input_pressed(machine, IPT_UI_CANCEL)) + else if (machine.ui_input().pressed(IPT_UI_CANCEL)) { machine.schedule_exit(); state = UI_HANDLER_CANCEL; @@ -1319,7 +1319,7 @@ UINT32 ui_manager::handler_messagebox_anykey(running_machine &machine, render_co machine.ui().draw_text_box(container, messagebox_text.c_str(), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); // if the user cancels, exit out completely - if (ui_input_pressed(machine, IPT_UI_CANCEL)) + if (machine.ui_input().pressed(IPT_UI_CANCEL)) { machine.schedule_exit(); state = UI_HANDLER_CANCEL; @@ -1348,7 +1348,7 @@ void ui_manager::process_natural_keyboard() UINT8 key_down_mask; // loop while we have interesting events - while (ui_input_pop_event(machine(), &event)) + while (machine().ui_input().pop_event(&event)) { // if this was a UI_EVENT_CHAR event, post it if (event.event_type == UI_EVENT_CHAR) @@ -1514,7 +1514,7 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co if (machine.ioport().has_keyboard()) { // are we toggling the UI with ScrLk? - if (ui_input_pressed(machine, IPT_UI_TOGGLE_UI)) + if (machine.ui_input().pressed(IPT_UI_TOGGLE_UI)) { // toggle the UI machine.set_ui_active(!machine.ui_active()); @@ -1550,7 +1550,7 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co if (!ui_disabled) { // paste command - if (ui_input_pressed(machine, IPT_UI_PASTE)) + if (machine.ui_input().pressed(IPT_UI_PASTE)) machine.ui().paste(); } @@ -1558,28 +1558,28 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co if (ui_disabled) return ui_disabled; - if (ui_input_pressed(machine, IPT_UI_CANCEL)) + if (machine.ui_input().pressed(IPT_UI_CANCEL)) { machine.ui().request_quit(); return 0; } // turn on menus if requested - if (ui_input_pressed(machine, IPT_UI_CONFIGURE)) + if (machine.ui_input().pressed(IPT_UI_CONFIGURE)) return machine.ui().set_handler(ui_menu::ui_handler, 0); // if the on-screen display isn't up and the user has toggled it, turn it on - if ((machine.debug_flags & DEBUG_FLAG_ENABLED) == 0 && ui_input_pressed(machine, IPT_UI_ON_SCREEN_DISPLAY)) + if ((machine.debug_flags & DEBUG_FLAG_ENABLED) == 0 && machine.ui_input().pressed(IPT_UI_ON_SCREEN_DISPLAY)) return machine.ui().set_handler(ui_menu_sliders::ui_handler, 1); // handle a reset request - if (ui_input_pressed(machine, IPT_UI_RESET_MACHINE)) + if (machine.ui_input().pressed(IPT_UI_RESET_MACHINE)) machine.schedule_hard_reset(); - if (ui_input_pressed(machine, IPT_UI_SOFT_RESET)) + if (machine.ui_input().pressed(IPT_UI_SOFT_RESET)) machine.schedule_soft_reset(); // handle a request to display graphics/palette - if (ui_input_pressed(machine, IPT_UI_SHOW_GFX)) + if (machine.ui_input().pressed(IPT_UI_SHOW_GFX)) { if (!is_paused) machine.pause(); @@ -1587,7 +1587,7 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co } // handle a tape control key - if (ui_input_pressed(machine, IPT_UI_TAPE_START)) + if (machine.ui_input().pressed(IPT_UI_TAPE_START)) { cassette_device_iterator cassiter(machine.root_device()); for (cassette_image_device *cass = cassiter.first(); cass != nullptr; cass = cassiter.next()) @@ -1596,7 +1596,7 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co return 0; } } - if (ui_input_pressed(machine, IPT_UI_TAPE_STOP)) + if (machine.ui_input().pressed(IPT_UI_TAPE_STOP)) { cassette_device_iterator cassiter(machine.root_device()); for (cassette_image_device *cass = cassiter.first(); cass != nullptr; cass = cassiter.next()) @@ -1607,25 +1607,25 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co } // handle a save state request - if (ui_input_pressed(machine, IPT_UI_SAVE_STATE)) + if (machine.ui_input().pressed(IPT_UI_SAVE_STATE)) { machine.pause(); return machine.ui().set_handler(handler_load_save, LOADSAVE_SAVE); } // handle a load state request - if (ui_input_pressed(machine, IPT_UI_LOAD_STATE)) + if (machine.ui_input().pressed(IPT_UI_LOAD_STATE)) { machine.pause(); return machine.ui().set_handler(handler_load_save, LOADSAVE_LOAD); } // handle a save snapshot request - if (ui_input_pressed(machine, IPT_UI_SNAPSHOT)) + if (machine.ui_input().pressed(IPT_UI_SNAPSHOT)) machine.video().save_active_screen_snapshots(); // toggle pause - if (ui_input_pressed(machine, IPT_UI_PAUSE)) + if (machine.ui_input().pressed(IPT_UI_PAUSE)) { // with a shift key, it is single step if (is_paused && (machine.input().code_pressed(KEYCODE_LSHIFT) || machine.input().code_pressed(KEYCODE_RSHIFT))) @@ -1638,31 +1638,31 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co } // handle a toggle cheats request - if (ui_input_pressed(machine, IPT_UI_TOGGLE_CHEAT)) + if (machine.ui_input().pressed(IPT_UI_TOGGLE_CHEAT)) machine.cheat().set_enable(!machine.cheat().enabled()); // toggle movie recording - if (ui_input_pressed(machine, IPT_UI_RECORD_MOVIE)) + if (machine.ui_input().pressed(IPT_UI_RECORD_MOVIE)) machine.video().toggle_record_movie(); // toggle profiler display - if (ui_input_pressed(machine, IPT_UI_SHOW_PROFILER)) + if (machine.ui_input().pressed(IPT_UI_SHOW_PROFILER)) machine.ui().set_show_profiler(!machine.ui().show_profiler()); // toggle FPS display - if (ui_input_pressed(machine, IPT_UI_SHOW_FPS)) + if (machine.ui_input().pressed(IPT_UI_SHOW_FPS)) machine.ui().set_show_fps(!machine.ui().show_fps()); // increment frameskip? - if (ui_input_pressed(machine, IPT_UI_FRAMESKIP_INC)) + if (machine.ui_input().pressed(IPT_UI_FRAMESKIP_INC)) machine.ui().increase_frameskip(); // decrement frameskip? - if (ui_input_pressed(machine, IPT_UI_FRAMESKIP_DEC)) + if (machine.ui_input().pressed(IPT_UI_FRAMESKIP_DEC)) machine.ui().decrease_frameskip(); // toggle throttle? - if (ui_input_pressed(machine, IPT_UI_THROTTLE)) + if (machine.ui_input().pressed(IPT_UI_THROTTLE)) machine.video().toggle_throttle(); // check for fast forward @@ -1699,7 +1699,7 @@ UINT32 ui_manager::handler_load_save(running_machine &machine, render_container machine.ui().draw_message_window(container, "Select position to load from"); // check for cancel key - if (ui_input_pressed(machine, IPT_UI_CANCEL)) + if (machine.ui_input().pressed(IPT_UI_CANCEL)) { // display a popup indicating things were cancelled if (state == LOADSAVE_SAVE) @@ -1787,11 +1787,11 @@ UINT32 ui_manager::handler_confirm_quit(running_machine &machine, render_contain machine.pause(); // if the user press ENTER, quit the game - if (ui_input_pressed(machine, IPT_UI_SELECT)) + if (machine.ui_input().pressed(IPT_UI_SELECT)) machine.schedule_exit(); // if the user press ESC, just continue - else if (ui_input_pressed(machine, IPT_UI_CANCEL)) + else if (machine.ui_input().pressed(IPT_UI_CANCEL)) { machine.resume(); state = UI_HANDLER_CANCEL; |