mirror of
https://github.com/holub/mame
synced 2025-07-06 18:39:28 +03:00
modernized ui_input_manager (nw)
This commit is contained in:
parent
2e5f16013c
commit
30c10f6f79
@ -1754,7 +1754,7 @@ void device_debug::start_hook(const attotime &endtime)
|
||||
}
|
||||
}
|
||||
// check for debug keypresses
|
||||
if (ui_input_pressed(m_device.machine(), IPT_UI_DEBUG_BREAK))
|
||||
if (m_device.machine().ui_input().pressed(IPT_UI_DEBUG_BREAK))
|
||||
global->visiblecpu->debug()->halt_on_next_instruction("User-initiated break\n");
|
||||
}
|
||||
|
||||
|
@ -2900,7 +2900,7 @@ g_profiler.start(PROFILER_INPUT);
|
||||
// perform mouse hit testing
|
||||
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 the button is pressed, map the point and determine what was hit
|
||||
ioport_field *mouse_field = nullptr;
|
||||
|
@ -119,7 +119,6 @@ running_machine::running_machine(const machine_config &_config, machine_manager
|
||||
primary_screen(nullptr),
|
||||
debug_flags(0),
|
||||
romload_data(nullptr),
|
||||
ui_input_data(nullptr),
|
||||
debugcpu_data(nullptr),
|
||||
m_config(_config),
|
||||
m_system(_config.gamedrv()),
|
||||
@ -243,7 +242,7 @@ void running_machine::start()
|
||||
m_base_time = newbase;
|
||||
|
||||
// intialize UI input
|
||||
ui_input_init(*this);
|
||||
m_ui_input = std::make_unique<ui_input_manager>(*this);
|
||||
|
||||
// initialize the streams engine before the sound devices start
|
||||
m_sound = std::make_unique<sound_manager>(*this);
|
||||
|
@ -89,11 +89,11 @@ class network_manager;
|
||||
class bookkeeping_manager;
|
||||
class configuration_manager;
|
||||
class output_manager;
|
||||
class ui_input_manager;
|
||||
class osd_interface;
|
||||
enum class config_type;
|
||||
|
||||
struct romload_private;
|
||||
struct ui_input_private;
|
||||
struct debugcpu_private;
|
||||
|
||||
|
||||
@ -172,6 +172,7 @@ public:
|
||||
configuration_manager &configuration() const { assert(m_configuration != nullptr); return *m_configuration; }
|
||||
output_manager &output() const { assert(m_output != nullptr); return *m_output; }
|
||||
ui_manager &ui() const { assert(m_ui != nullptr); return *m_ui; }
|
||||
ui_input_manager &ui_input() const { assert(m_ui_input != nullptr); return *m_ui_input; }
|
||||
tilemap_manager &tilemap() const { assert(m_tilemap != nullptr); return *m_tilemap; }
|
||||
debug_view_manager &debug_view() const { assert(m_debug_view != nullptr); return *m_debug_view; }
|
||||
driver_device *driver_data() const { return &downcast<driver_device &>(root_device()); }
|
||||
@ -244,7 +245,6 @@ public:
|
||||
|
||||
// internal core information
|
||||
romload_private * romload_data; // internal data from romload.c
|
||||
ui_input_private * ui_input_data; // internal data from uiinput.c
|
||||
debugcpu_private * debugcpu_data; // internal data from debugcpu.c
|
||||
|
||||
private:
|
||||
@ -284,6 +284,7 @@ private:
|
||||
std::unique_ptr<sound_manager> m_sound; // internal data from sound.c
|
||||
std::unique_ptr<video_manager> m_video; // internal data from video.c
|
||||
std::unique_ptr<ui_manager> m_ui; // internal data from ui.c
|
||||
std::unique_ptr<ui_input_manager> m_ui_input; // internal data from uiinput.c
|
||||
std::unique_ptr<tilemap_manager> m_tilemap; // internal data from tilemap.c
|
||||
std::unique_ptr<debug_view_manager> m_debug_view; // internal data from debugvw.c
|
||||
std::unique_ptr<network_manager> m_network; // internal data from network.c
|
||||
|
@ -266,7 +266,7 @@ void ui_menu_input::handle()
|
||||
input_item_data *item = pollingitem;
|
||||
|
||||
/* if UI_CANCEL is pressed, abort */
|
||||
if (ui_input_pressed(machine(), IPT_UI_CANCEL))
|
||||
if (machine().ui_input().pressed(IPT_UI_CANCEL))
|
||||
{
|
||||
pollingitem = nullptr;
|
||||
record_next = false;
|
||||
|
@ -58,7 +58,7 @@ inline bool ui_menu_item::is_selectable() const
|
||||
|
||||
inline bool ui_menu::exclusive_input_pressed(int key, int repeat)
|
||||
{
|
||||
if (menu_event.iptkey == IPT_INVALID && ui_input_pressed_repeat(machine(), key, repeat))
|
||||
if (menu_event.iptkey == IPT_INVALID && machine().ui_input().pressed_repeat(key, repeat))
|
||||
{
|
||||
menu_event.iptkey = key;
|
||||
return true;
|
||||
@ -492,7 +492,7 @@ void ui_menu::draw(bool customonly)
|
||||
mouse_button = false;
|
||||
if (!customonly)
|
||||
{
|
||||
mouse_target = ui_input_find_mouse(machine(), &mouse_target_x, &mouse_target_y, &mouse_button);
|
||||
mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button);
|
||||
if (mouse_target != nullptr)
|
||||
if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y))
|
||||
mouse_hit = true;
|
||||
@ -749,7 +749,7 @@ void ui_menu::handle_events()
|
||||
ui_event local_menu_event;
|
||||
|
||||
// loop while we have interesting events
|
||||
while (!stop && ui_input_pop_event(machine(), &local_menu_event))
|
||||
while (!stop && machine().ui_input().pop_event(&local_menu_event))
|
||||
{
|
||||
switch (local_menu_event.event_type)
|
||||
{
|
||||
@ -901,7 +901,7 @@ void ui_menu::handle_keys(UINT32 flags)
|
||||
}
|
||||
|
||||
// handle a toggle cheats request
|
||||
if (ui_input_pressed_repeat(machine(), IPT_UI_TOGGLE_CHEAT, 0))
|
||||
if (machine().ui_input().pressed_repeat(IPT_UI_TOGGLE_CHEAT, 0))
|
||||
machine().cheat().set_enable(!machine().cheat().enabled());
|
||||
|
||||
// see if any other UI keys are pressed
|
||||
@ -979,7 +979,7 @@ void ui_menu::stack_push(ui_menu *menu)
|
||||
menu->parent = menu_stack;
|
||||
menu_stack = menu;
|
||||
menu->reset(UI_MENU_RESET_SELECT_FIRST);
|
||||
ui_input_reset(menu->machine());
|
||||
menu->machine().ui_input().reset();
|
||||
}
|
||||
|
||||
|
||||
@ -995,7 +995,7 @@ void ui_menu::stack_pop(running_machine &machine)
|
||||
menu_stack = menu->parent;
|
||||
menu->parent = menu_free;
|
||||
menu_free = menu;
|
||||
ui_input_reset(machine);
|
||||
machine.ui_input().reset();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1047,7 +1047,7 @@ UINT32 ui_menu::ui_handler(running_machine &machine, render_container *container
|
||||
clear_free_list(machine);
|
||||
|
||||
// if the menus are to be hidden, return a cancel here
|
||||
if (machine.ui().is_menu_active() && ((ui_input_pressed(machine, IPT_UI_CONFIGURE) && !stack_has_special_main_menu()) || menu_stack == nullptr))
|
||||
if (machine.ui().is_menu_active() && ((machine.ui_input().pressed(IPT_UI_CONFIGURE) && !stack_has_special_main_menu()) || menu_stack == nullptr))
|
||||
return UI_HANDLER_CANCEL;
|
||||
|
||||
return 0;
|
||||
|
@ -94,7 +94,7 @@ void ui_menu_select_game::build_driver_list()
|
||||
void ui_menu_select_game::handle()
|
||||
{
|
||||
// ignore pause keys by swallowing them before we process the menu
|
||||
ui_input_pressed(machine(), IPT_UI_PAUSE);
|
||||
machine().ui_input().pressed(IPT_UI_PAUSE);
|
||||
|
||||
// process the menu
|
||||
const ui_menu_event *menu_event = process(0);
|
||||
|
@ -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;
|
||||
|
@ -301,13 +301,13 @@ again:
|
||||
}
|
||||
|
||||
// handle keys
|
||||
if (ui_input_pressed(machine, IPT_UI_SELECT))
|
||||
if (machine.ui_input().pressed(IPT_UI_SELECT))
|
||||
{
|
||||
state.mode = (state.mode + 1) % 3;
|
||||
state.bitmap_dirty = true;
|
||||
}
|
||||
|
||||
if (ui_input_pressed(machine, IPT_UI_PAUSE))
|
||||
if (machine.ui_input().pressed(IPT_UI_PAUSE))
|
||||
{
|
||||
if (machine.paused())
|
||||
machine.resume();
|
||||
@ -315,7 +315,7 @@ again:
|
||||
machine.pause();
|
||||
}
|
||||
|
||||
if (ui_input_pressed(machine, IPT_UI_CANCEL) || ui_input_pressed(machine, IPT_UI_SHOW_GFX))
|
||||
if (machine.ui_input().pressed(IPT_UI_CANCEL) || machine.ui_input().pressed(IPT_UI_SHOW_GFX))
|
||||
goto cancel;
|
||||
|
||||
return uistate;
|
||||
@ -481,9 +481,9 @@ static void palette_handle_keys(running_machine &machine, ui_gfx_state &state)
|
||||
int total;
|
||||
|
||||
// handle zoom (minus,plus)
|
||||
if (ui_input_pressed(machine, IPT_UI_ZOOM_OUT))
|
||||
if (machine.ui_input().pressed(IPT_UI_ZOOM_OUT))
|
||||
state.palette.columns /= 2;
|
||||
if (ui_input_pressed(machine, IPT_UI_ZOOM_IN))
|
||||
if (machine.ui_input().pressed(IPT_UI_ZOOM_IN))
|
||||
state.palette.columns *= 2;
|
||||
|
||||
// clamp within range
|
||||
@ -493,7 +493,7 @@ static void palette_handle_keys(running_machine &machine, ui_gfx_state &state)
|
||||
state.palette.columns = 64;
|
||||
|
||||
// handle colormap selection (open bracket,close bracket)
|
||||
if (ui_input_pressed(machine, IPT_UI_PREV_GROUP))
|
||||
if (machine.ui_input().pressed(IPT_UI_PREV_GROUP))
|
||||
{
|
||||
if (state.palette.which)
|
||||
state.palette.which = 0;
|
||||
@ -505,7 +505,7 @@ static void palette_handle_keys(running_machine &machine, ui_gfx_state &state)
|
||||
state.palette.which = (palette->indirect_entries() > 0);
|
||||
}
|
||||
}
|
||||
if (ui_input_pressed(machine, IPT_UI_NEXT_GROUP))
|
||||
if (machine.ui_input().pressed(IPT_UI_NEXT_GROUP))
|
||||
{
|
||||
if (!state.palette.which && palette->indirect_entries() > 0)
|
||||
state.palette.which = 1;
|
||||
@ -526,17 +526,17 @@ static void palette_handle_keys(running_machine &machine, ui_gfx_state &state)
|
||||
screencount = rowcount * rowcount;
|
||||
|
||||
// handle keyboard navigation
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_UP, 4))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_UP, 4))
|
||||
state.palette.offset -= rowcount;
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_DOWN, 4))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_DOWN, 4))
|
||||
state.palette.offset += rowcount;
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_PAGE_UP, 6))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_PAGE_UP, 6))
|
||||
state.palette.offset -= screencount;
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_PAGE_DOWN, 6))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_PAGE_DOWN, 6))
|
||||
state.palette.offset += screencount;
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_HOME, 4))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_HOME, 4))
|
||||
state.palette.offset = 0;
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_END, 4))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_END, 4))
|
||||
state.palette.offset = total;
|
||||
|
||||
// clamp within range
|
||||
@ -731,7 +731,7 @@ static void gfxset_handler(running_machine &machine, render_container *container
|
||||
static void gfxset_handle_keys(running_machine &machine, ui_gfx_state &state, int xcells, int ycells)
|
||||
{
|
||||
// handle gfxset selection (open bracket,close bracket)
|
||||
if (ui_input_pressed(machine, IPT_UI_PREV_GROUP))
|
||||
if (machine.ui_input().pressed(IPT_UI_PREV_GROUP))
|
||||
{
|
||||
if (state.gfxset.set > 0)
|
||||
state.gfxset.set--;
|
||||
@ -742,7 +742,7 @@ static void gfxset_handle_keys(running_machine &machine, ui_gfx_state &state, in
|
||||
}
|
||||
state.bitmap_dirty = true;
|
||||
}
|
||||
if (ui_input_pressed(machine, IPT_UI_NEXT_GROUP))
|
||||
if (machine.ui_input().pressed(IPT_UI_NEXT_GROUP))
|
||||
{
|
||||
if (state.gfxset.set < state.gfxdev[state.gfxset.devindex].setcount - 1)
|
||||
state.gfxset.set++;
|
||||
@ -761,10 +761,10 @@ static void gfxset_handle_keys(running_machine &machine, ui_gfx_state &state, in
|
||||
gfx_element &gfx = *info.interface->gfx(set);
|
||||
|
||||
// handle cells per line (minus,plus)
|
||||
if (ui_input_pressed(machine, IPT_UI_ZOOM_OUT))
|
||||
if (machine.ui_input().pressed(IPT_UI_ZOOM_OUT))
|
||||
{ info.columns[set] = xcells - 1; state.bitmap_dirty = true; }
|
||||
|
||||
if (ui_input_pressed(machine, IPT_UI_ZOOM_IN))
|
||||
if (machine.ui_input().pressed(IPT_UI_ZOOM_IN))
|
||||
{ info.columns[set] = xcells + 1; state.bitmap_dirty = true; }
|
||||
|
||||
// clamp within range
|
||||
@ -774,24 +774,24 @@ static void gfxset_handle_keys(running_machine &machine, ui_gfx_state &state, in
|
||||
{ info.columns[set] = 128; state.bitmap_dirty = true; }
|
||||
|
||||
// handle rotation (R)
|
||||
if (ui_input_pressed(machine, IPT_UI_ROTATE))
|
||||
if (machine.ui_input().pressed(IPT_UI_ROTATE))
|
||||
{
|
||||
info.rotate[set] = orientation_add(ROT90, info.rotate[set]);
|
||||
state.bitmap_dirty = true;
|
||||
}
|
||||
|
||||
// handle navigation within the cells (up,down,pgup,pgdown)
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_UP, 4))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_UP, 4))
|
||||
{ info.offset[set] -= xcells; state.bitmap_dirty = true; }
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_DOWN, 4))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_DOWN, 4))
|
||||
{ info.offset[set] += xcells; state.bitmap_dirty = true; }
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_PAGE_UP, 6))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_PAGE_UP, 6))
|
||||
{ info.offset[set] -= xcells * ycells; state.bitmap_dirty = true; }
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_PAGE_DOWN, 6))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_PAGE_DOWN, 6))
|
||||
{ info.offset[set] += xcells * ycells; state.bitmap_dirty = true; }
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_HOME, 4))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_HOME, 4))
|
||||
{ info.offset[set] = 0; state.bitmap_dirty = true; }
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_END, 4))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_END, 4))
|
||||
{ info.offset[set] = gfx.elements(); state.bitmap_dirty = true; }
|
||||
|
||||
// clamp within range
|
||||
@ -804,9 +804,9 @@ static void gfxset_handle_keys(running_machine &machine, ui_gfx_state &state, in
|
||||
{ info.offset[set] = 0; state.bitmap_dirty = true; }
|
||||
|
||||
// handle color selection (left,right)
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_LEFT, 4))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_LEFT, 4))
|
||||
{ info.color[set] -= 1; state.bitmap_dirty = true; }
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_RIGHT, 4))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_RIGHT, 4))
|
||||
{ info.color[set] += 1; state.bitmap_dirty = true; }
|
||||
|
||||
// clamp within range
|
||||
@ -1073,9 +1073,9 @@ static void tilemap_handle_keys(running_machine &machine, ui_gfx_state &state, i
|
||||
int step;
|
||||
|
||||
// handle tilemap selection (open bracket,close bracket)
|
||||
if (ui_input_pressed(machine, IPT_UI_PREV_GROUP) && state.tilemap.which > 0)
|
||||
if (machine.ui_input().pressed(IPT_UI_PREV_GROUP) && state.tilemap.which > 0)
|
||||
{ state.tilemap.which--; state.bitmap_dirty = true; }
|
||||
if (ui_input_pressed(machine, IPT_UI_NEXT_GROUP) && state.tilemap.which < machine.tilemap().count() - 1)
|
||||
if (machine.ui_input().pressed(IPT_UI_NEXT_GROUP) && state.tilemap.which < machine.tilemap().count() - 1)
|
||||
{ state.tilemap.which++; state.bitmap_dirty = true; }
|
||||
|
||||
// cache some info in locals
|
||||
@ -1084,7 +1084,7 @@ static void tilemap_handle_keys(running_machine &machine, ui_gfx_state &state, i
|
||||
mapheight = tilemap->height();
|
||||
|
||||
// handle zoom (minus,plus)
|
||||
if (ui_input_pressed(machine, IPT_UI_ZOOM_OUT) && state.tilemap.zoom > 0)
|
||||
if (machine.ui_input().pressed(IPT_UI_ZOOM_OUT) && state.tilemap.zoom > 0)
|
||||
{
|
||||
state.tilemap.zoom--;
|
||||
state.bitmap_dirty = true;
|
||||
@ -1093,7 +1093,7 @@ static void tilemap_handle_keys(running_machine &machine, ui_gfx_state &state, i
|
||||
else
|
||||
machine.popmessage("Zoom Auto");
|
||||
}
|
||||
if (ui_input_pressed(machine, IPT_UI_ZOOM_IN) && state.tilemap.zoom < 8)
|
||||
if (machine.ui_input().pressed(IPT_UI_ZOOM_IN) && state.tilemap.zoom < 8)
|
||||
{
|
||||
state.tilemap.zoom++;
|
||||
state.bitmap_dirty = true;
|
||||
@ -1101,7 +1101,7 @@ static void tilemap_handle_keys(running_machine &machine, ui_gfx_state &state, i
|
||||
}
|
||||
|
||||
// handle rotation (R)
|
||||
if (ui_input_pressed(machine, IPT_UI_ROTATE))
|
||||
if (machine.ui_input().pressed(IPT_UI_ROTATE))
|
||||
{
|
||||
state.tilemap.rotate = orientation_add(ROT90, state.tilemap.rotate);
|
||||
state.bitmap_dirty = true;
|
||||
@ -1111,13 +1111,13 @@ static void tilemap_handle_keys(running_machine &machine, ui_gfx_state &state, i
|
||||
step = 8;
|
||||
if (machine.input().code_pressed(KEYCODE_LSHIFT)) step = 1;
|
||||
if (machine.input().code_pressed(KEYCODE_LCONTROL)) step = 64;
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_UP, 4))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_UP, 4))
|
||||
{ state.tilemap.yoffs -= step; state.bitmap_dirty = true; }
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_DOWN, 4))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_DOWN, 4))
|
||||
{ state.tilemap.yoffs += step; state.bitmap_dirty = true; }
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_LEFT, 6))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_LEFT, 6))
|
||||
{ state.tilemap.xoffs -= step; state.bitmap_dirty = true; }
|
||||
if (ui_input_pressed_repeat(machine, IPT_UI_RIGHT, 6))
|
||||
if (machine.ui_input().pressed_repeat(IPT_UI_RIGHT, 6))
|
||||
{ state.tilemap.xoffs += step; state.bitmap_dirty = true; }
|
||||
|
||||
// clamp within range
|
||||
|
@ -16,8 +16,6 @@
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
|
||||
#define EVENT_QUEUE_SIZE 128
|
||||
|
||||
enum
|
||||
{
|
||||
SEQ_PRESSED_FALSE = 0, /* not pressed */
|
||||
@ -26,58 +24,31 @@ enum
|
||||
};
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// NETWORK MANAGER
|
||||
//**************************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
//-------------------------------------------------
|
||||
// network_manager - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
/* private input port state */
|
||||
struct ui_input_private
|
||||
{
|
||||
/* pressed states; retrieved with ui_input_pressed() */
|
||||
osd_ticks_t next_repeat[IPT_COUNT];
|
||||
UINT8 seqpressed[IPT_COUNT];
|
||||
|
||||
/* mouse position/info */
|
||||
render_target * current_mouse_target;
|
||||
INT32 current_mouse_x;
|
||||
INT32 current_mouse_y;
|
||||
bool current_mouse_down;
|
||||
|
||||
/* popped states; ring buffer of ui_events */
|
||||
ui_event events[EVENT_QUEUE_SIZE];
|
||||
int events_start;
|
||||
int events_end;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
FUNCTION PROTOYPES
|
||||
***************************************************************************/
|
||||
|
||||
//static void ui_input_frame_update(running_machine &machine);
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
INITIALIZATION
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_input_init - initializes the UI input
|
||||
system
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_input_init(running_machine &machine)
|
||||
ui_input_manager::ui_input_manager(running_machine &machine)
|
||||
: m_machine(machine),
|
||||
m_current_mouse_target(nullptr),
|
||||
m_current_mouse_down(false),
|
||||
m_events_start(0),
|
||||
m_events_end(0)
|
||||
{
|
||||
/* create the private data */
|
||||
machine.ui_input_data = auto_alloc_clear(machine, <ui_input_private>());
|
||||
machine.ui_input_data->current_mouse_x = -1;
|
||||
machine.ui_input_data->current_mouse_y = -1;
|
||||
m_current_mouse_x = -1;
|
||||
m_current_mouse_y = -1;
|
||||
|
||||
memset(m_next_repeat, 0, sizeof(m_next_repeat));
|
||||
memset(m_seqpressed, 0, sizeof(m_seqpressed));
|
||||
memset(m_events, 0, sizeof(m_events));
|
||||
|
||||
/* add a frame callback to poll inputs */
|
||||
machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(ui_input_frame_update), &machine));
|
||||
machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(ui_input_manager::frame_update), this));
|
||||
}
|
||||
|
||||
|
||||
@ -87,62 +58,55 @@ void ui_input_init(running_machine &machine)
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_input_frame_update - looks through pressed
|
||||
frame_update - looks through pressed
|
||||
input as per events pushed our way and posts
|
||||
corresponding IPT_UI_* events
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_input_frame_update(running_machine &machine)
|
||||
void ui_input_manager::frame_update()
|
||||
{
|
||||
ui_input_private *uidata = machine.ui_input_data;
|
||||
|
||||
/* update the state of all the UI keys */
|
||||
for (ioport_type code = ioport_type(IPT_UI_FIRST + 1); code < IPT_UI_LAST; ++code)
|
||||
{
|
||||
bool pressed = machine.ioport().type_pressed(code);
|
||||
if (!pressed || uidata->seqpressed[code] != SEQ_PRESSED_RESET)
|
||||
uidata->seqpressed[code] = pressed;
|
||||
bool pressed = machine().ioport().type_pressed(code);
|
||||
if (!pressed || m_seqpressed[code] != SEQ_PRESSED_RESET)
|
||||
m_seqpressed[code] = pressed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_input_push_event - pushes a single event
|
||||
push_event - pushes a single event
|
||||
onto the queue
|
||||
-------------------------------------------------*/
|
||||
|
||||
bool ui_input_push_event(running_machine &machine, ui_event evt)
|
||||
bool ui_input_manager::push_event(ui_event evt)
|
||||
{
|
||||
ui_input_private *uidata = machine.ui_input_data;
|
||||
|
||||
/* we may be called before the UI is initialized */
|
||||
if (uidata == nullptr)
|
||||
return false;
|
||||
|
||||
/* some pre-processing (this is an icky place to do this stuff!) */
|
||||
switch (evt.event_type)
|
||||
{
|
||||
case UI_EVENT_MOUSE_MOVE:
|
||||
uidata->current_mouse_target = evt.target;
|
||||
uidata->current_mouse_x = evt.mouse_x;
|
||||
uidata->current_mouse_y = evt.mouse_y;
|
||||
m_current_mouse_target = evt.target;
|
||||
m_current_mouse_x = evt.mouse_x;
|
||||
m_current_mouse_y = evt.mouse_y;
|
||||
break;
|
||||
|
||||
case UI_EVENT_MOUSE_LEAVE:
|
||||
if (uidata->current_mouse_target == evt.target)
|
||||
if (m_current_mouse_target == evt.target)
|
||||
{
|
||||
uidata->current_mouse_target = nullptr;
|
||||
uidata->current_mouse_x = -1;
|
||||
uidata->current_mouse_y = -1;
|
||||
m_current_mouse_target = nullptr;
|
||||
m_current_mouse_x = -1;
|
||||
m_current_mouse_y = -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case UI_EVENT_MOUSE_DOWN:
|
||||
uidata->current_mouse_down = true;
|
||||
m_current_mouse_down = true;
|
||||
break;
|
||||
|
||||
case UI_EVENT_MOUSE_UP:
|
||||
uidata->current_mouse_down = false;
|
||||
m_current_mouse_down = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -151,28 +115,27 @@ bool ui_input_push_event(running_machine &machine, ui_event evt)
|
||||
}
|
||||
|
||||
/* is the queue filled up? */
|
||||
if ((uidata->events_end + 1) % ARRAY_LENGTH(uidata->events) == uidata->events_start)
|
||||
if ((m_events_end + 1) % ARRAY_LENGTH(m_events) == m_events_start)
|
||||
return false;
|
||||
|
||||
uidata->events[uidata->events_end++] = evt;
|
||||
uidata->events_end %= ARRAY_LENGTH(uidata->events);
|
||||
m_events[m_events_end++] = evt;
|
||||
m_events_end %= ARRAY_LENGTH(m_events);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_input_pop_event - pops an event off of the queue
|
||||
pop_event - pops an event off of the queue
|
||||
-------------------------------------------------*/
|
||||
|
||||
bool ui_input_pop_event(running_machine &machine, ui_event *evt)
|
||||
bool ui_input_manager::pop_event(ui_event *evt)
|
||||
{
|
||||
ui_input_private *uidata = machine.ui_input_data;
|
||||
bool result;
|
||||
|
||||
if (uidata->events_start != uidata->events_end)
|
||||
if (m_events_start != m_events_end)
|
||||
{
|
||||
*evt = uidata->events[uidata->events_start++];
|
||||
uidata->events_start %= ARRAY_LENGTH(uidata->events);
|
||||
*evt = m_events[m_events_start++];
|
||||
m_events_start %= ARRAY_LENGTH(m_events);
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
@ -185,40 +148,38 @@ bool ui_input_pop_event(running_machine &machine, ui_event *evt)
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_input_reset - clears all outstanding events
|
||||
reset - clears all outstanding events
|
||||
and resets the sequence states
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_input_reset(running_machine &machine)
|
||||
void ui_input_manager::reset()
|
||||
{
|
||||
ui_input_private *uidata = machine.ui_input_data;
|
||||
int code;
|
||||
|
||||
uidata->events_start = 0;
|
||||
uidata->events_end = 0;
|
||||
m_events_start = 0;
|
||||
m_events_end = 0;
|
||||
for (code = IPT_UI_FIRST + 1; code < IPT_UI_LAST; code++)
|
||||
{
|
||||
uidata->seqpressed[code] = SEQ_PRESSED_RESET;
|
||||
uidata->next_repeat[code] = 0;
|
||||
m_seqpressed[code] = SEQ_PRESSED_RESET;
|
||||
m_next_repeat[code] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_input_find_mouse - retrieves the current
|
||||
find_mouse - retrieves the current
|
||||
location of the mouse
|
||||
-------------------------------------------------*/
|
||||
|
||||
render_target *ui_input_find_mouse(running_machine &machine, INT32 *x, INT32 *y, bool *button)
|
||||
render_target *ui_input_manager::find_mouse(INT32 *x, INT32 *y, bool *button)
|
||||
{
|
||||
ui_input_private *uidata = machine.ui_input_data;
|
||||
if (x != nullptr)
|
||||
*x = uidata->current_mouse_x;
|
||||
*x = m_current_mouse_x;
|
||||
if (y != nullptr)
|
||||
*y = uidata->current_mouse_y;
|
||||
*y = m_current_mouse_y;
|
||||
if (button != nullptr)
|
||||
*button = uidata->current_mouse_down;
|
||||
return uidata->current_mouse_target;
|
||||
*button = m_current_mouse_down;
|
||||
return m_current_mouse_target;
|
||||
}
|
||||
|
||||
|
||||
@ -228,34 +189,33 @@ render_target *ui_input_find_mouse(running_machine &machine, INT32 *x, INT32 *y,
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_input_pressed - return TRUE if a key down
|
||||
pressed - return TRUE if a key down
|
||||
for the given user interface sequence is
|
||||
detected
|
||||
-------------------------------------------------*/
|
||||
|
||||
bool ui_input_pressed(running_machine &machine, int code)
|
||||
bool ui_input_manager::pressed(int code)
|
||||
{
|
||||
return ui_input_pressed_repeat(machine, code, 0);
|
||||
return pressed_repeat(code, 0);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_input_pressed_repeat - return TRUE if a key
|
||||
pressed_repeat - return TRUE if a key
|
||||
down for the given user interface sequence is
|
||||
detected, or if autorepeat at the given speed
|
||||
is triggered
|
||||
-------------------------------------------------*/
|
||||
|
||||
bool ui_input_pressed_repeat(running_machine &machine, int code, int speed)
|
||||
bool ui_input_manager::pressed_repeat(int code, int speed)
|
||||
{
|
||||
ui_input_private *uidata = machine.ui_input_data;
|
||||
int pressed;
|
||||
|
||||
g_profiler.start(PROFILER_INPUT);
|
||||
|
||||
/* get the status of this key (assumed to be only in the defaults) */
|
||||
assert(code >= IPT_UI_CONFIGURE && code <= IPT_OSD_16);
|
||||
pressed = (uidata->seqpressed[code] == SEQ_PRESSED_TRUE);
|
||||
pressed = (m_seqpressed[code] == SEQ_PRESSED_TRUE);
|
||||
|
||||
/* if down, handle it specially */
|
||||
if (pressed)
|
||||
@ -263,12 +223,12 @@ g_profiler.start(PROFILER_INPUT);
|
||||
osd_ticks_t tps = osd_ticks_per_second();
|
||||
|
||||
/* if this is the first press, set a 3x delay and leave pressed = 1 */
|
||||
if (uidata->next_repeat[code] == 0)
|
||||
uidata->next_repeat[code] = osd_ticks() + 3 * speed * tps / 60;
|
||||
if (m_next_repeat[code] == 0)
|
||||
m_next_repeat[code] = osd_ticks() + 3 * speed * tps / 60;
|
||||
|
||||
/* if this is an autorepeat case, set a 1x delay and leave pressed = 1 */
|
||||
else if (speed > 0 && (osd_ticks() + tps - uidata->next_repeat[code]) >= tps)
|
||||
uidata->next_repeat[code] += 1 * speed * tps / 60;
|
||||
else if (speed > 0 && (osd_ticks() + tps - m_next_repeat[code]) >= tps)
|
||||
m_next_repeat[code] += 1 * speed * tps / 60;
|
||||
|
||||
/* otherwise, reset pressed = 0 */
|
||||
else
|
||||
@ -277,9 +237,95 @@ g_profiler.start(PROFILER_INPUT);
|
||||
|
||||
/* if we're not pressed, reset the memory field */
|
||||
else
|
||||
uidata->next_repeat[code] = 0;
|
||||
m_next_repeat[code] = 0;
|
||||
|
||||
g_profiler.stop();
|
||||
|
||||
return pressed;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
push_mouse_move_event - pushes a mouse
|
||||
move event to the specified render_target
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_input_manager::push_mouse_move_event(render_target* target, INT32 x, INT32 y)
|
||||
{
|
||||
ui_event event = { UI_EVENT_NONE };
|
||||
event.event_type = UI_EVENT_MOUSE_MOVE;
|
||||
event.target = target;
|
||||
event.mouse_x = x;
|
||||
event.mouse_y = y;
|
||||
push_event(event);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
push_mouse_leave_event - pushes a
|
||||
mouse leave event to the specified render_target
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_input_manager::push_mouse_leave_event(render_target* target)
|
||||
{
|
||||
ui_event event = { UI_EVENT_NONE };
|
||||
event.event_type = UI_EVENT_MOUSE_LEAVE;
|
||||
event.target = target;
|
||||
push_event(event);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
push_mouse_down_event - pushes a mouse
|
||||
down event to the specified render_target
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_input_manager::push_mouse_down_event(render_target* target, INT32 x, INT32 y)
|
||||
{
|
||||
ui_event event = { UI_EVENT_NONE };
|
||||
event.event_type = UI_EVENT_MOUSE_DOWN;
|
||||
event.target = target;
|
||||
event.mouse_x = x;
|
||||
event.mouse_y = y;
|
||||
push_event(event);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
push_mouse_down_event - pushes a mouse
|
||||
down event to the specified render_target
|
||||
-------------------------------------------------*/
|
||||
|
||||
void ui_input_manager::push_mouse_up_event(render_target* target, INT32 x, INT32 y)
|
||||
{
|
||||
ui_event event = { UI_EVENT_NONE };
|
||||
event.event_type = UI_EVENT_MOUSE_UP;
|
||||
event.target = target;
|
||||
event.mouse_x = x;
|
||||
event.mouse_y = y;
|
||||
push_event(event);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
push_mouse_double_click_event - pushes
|
||||
a mouse double-click event to the specified
|
||||
render_target
|
||||
-------------------------------------------------*/
|
||||
void ui_input_manager::push_mouse_double_click_event(render_target* target, INT32 x, INT32 y)
|
||||
{
|
||||
ui_event event = { UI_EVENT_NONE };
|
||||
event.event_type = UI_EVENT_MOUSE_DOUBLE_CLICK;
|
||||
event.target = target;
|
||||
event.mouse_x = x;
|
||||
event.mouse_y = y;
|
||||
push_event(event);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
push_char_event - pushes a char event
|
||||
to the specified render_target
|
||||
-------------------------------------------------*/
|
||||
void ui_input_manager::push_char_event(render_target* target, unicode_char ch)
|
||||
{
|
||||
ui_event event = { UI_EVENT_NONE };
|
||||
event.event_type = UI_EVENT_CHAR;
|
||||
event.target = target;
|
||||
event.ch = ch;
|
||||
push_event(event);
|
||||
}
|
||||
|
@ -15,6 +15,12 @@
|
||||
#include "render.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
|
||||
#define EVENT_QUEUE_SIZE 128
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
@ -30,7 +36,6 @@ enum ui_event_type
|
||||
UI_EVENT_CHAR
|
||||
};
|
||||
|
||||
|
||||
struct ui_event
|
||||
{
|
||||
ui_event_type event_type;
|
||||
@ -41,145 +46,67 @@ struct ui_event
|
||||
unicode_char ch;
|
||||
};
|
||||
|
||||
// ======================> ui_input_manager
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
/* ----- core system management ----- */
|
||||
|
||||
/* initialization */
|
||||
void ui_input_init(running_machine &machine);
|
||||
|
||||
|
||||
|
||||
/* ----- event handling ----- */
|
||||
|
||||
void ui_input_frame_update(running_machine &machine);
|
||||
|
||||
/* pushes a single event onto the queue */
|
||||
bool ui_input_push_event(running_machine &machine, ui_event event);
|
||||
|
||||
/* pops an event off of the queue */
|
||||
bool ui_input_pop_event(running_machine &machine, ui_event *event);
|
||||
|
||||
/* clears all outstanding events */
|
||||
void ui_input_reset(running_machine &machine);
|
||||
|
||||
/* retrieves the current location of the mouse */
|
||||
render_target *ui_input_find_mouse(running_machine &machine, INT32 *x, INT32 *y, bool *button);
|
||||
|
||||
|
||||
|
||||
/* ----- user interface sequence reading ----- */
|
||||
|
||||
/* return TRUE if a key down for the given user interface sequence is detected */
|
||||
bool ui_input_pressed(running_machine &machine, int code);
|
||||
|
||||
/* return TRUE if a key down for the given user interface sequence is detected, or if
|
||||
autorepeat at the given speed is triggered */
|
||||
bool ui_input_pressed_repeat(running_machine &machine, int code, int speed);
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
INLINE FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_input_push_mouse_move_event - pushes a mouse
|
||||
move event to the specified render_target
|
||||
-------------------------------------------------*/
|
||||
|
||||
static inline void ui_input_push_mouse_move_event(running_machine &machine, render_target *target, INT32 x, INT32 y)
|
||||
class ui_input_manager
|
||||
{
|
||||
ui_event event = { UI_EVENT_NONE };
|
||||
event.event_type = UI_EVENT_MOUSE_MOVE;
|
||||
event.target = target;
|
||||
event.mouse_x = x;
|
||||
event.mouse_y = y;
|
||||
ui_input_push_event(machine, event);
|
||||
}
|
||||
public:
|
||||
// construction/destruction
|
||||
ui_input_manager(running_machine &machine);
|
||||
|
||||
void frame_update();
|
||||
|
||||
/* pushes a single event onto the queue */
|
||||
bool push_event(ui_event event);
|
||||
|
||||
/* pops an event off of the queue */
|
||||
bool pop_event(ui_event *event);
|
||||
|
||||
/* clears all outstanding events */
|
||||
void reset();
|
||||
|
||||
/* retrieves the current location of the mouse */
|
||||
render_target *find_mouse(INT32 *x, INT32 *y, bool *button);
|
||||
|
||||
/* return TRUE if a key down for the given user interface sequence is detected */
|
||||
bool pressed(int code);
|
||||
|
||||
/* return TRUE if a key down for the given user interface sequence is detected, or if
|
||||
autorepeat at the given speed is triggered */
|
||||
bool pressed_repeat(int code, int speed);
|
||||
|
||||
// getters
|
||||
running_machine &machine() const { return m_machine; }
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_input_push_mouse_leave_event - pushes a
|
||||
mouse leave event to the specified render_target
|
||||
-------------------------------------------------*/
|
||||
void push_mouse_move_event(render_target* target, INT32 x, INT32 y);
|
||||
void push_mouse_leave_event(render_target* target);
|
||||
void push_mouse_down_event(render_target* target, INT32 x, INT32 y);
|
||||
void push_mouse_up_event(render_target* target, INT32 x, INT32 y);
|
||||
void push_mouse_double_click_event(render_target* target, INT32 x, INT32 y);
|
||||
void push_char_event(render_target* target, unicode_char ch);
|
||||
|
||||
static inline void ui_input_push_mouse_leave_event(running_machine &machine, render_target *target)
|
||||
{
|
||||
ui_event event = { UI_EVENT_NONE };
|
||||
event.event_type = UI_EVENT_MOUSE_LEAVE;
|
||||
event.target = target;
|
||||
ui_input_push_event(machine, event);
|
||||
}
|
||||
private:
|
||||
|
||||
// internal state
|
||||
running_machine & m_machine; // reference to our machine
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_input_push_mouse_down_event - pushes a mouse
|
||||
down event to the specified render_target
|
||||
-------------------------------------------------*/
|
||||
/* pressed states; retrieved with ui_input_pressed() */
|
||||
osd_ticks_t m_next_repeat[IPT_COUNT];
|
||||
UINT8 m_seqpressed[IPT_COUNT];
|
||||
|
||||
static inline void ui_input_push_mouse_down_event(running_machine &machine, render_target *target, INT32 x, INT32 y)
|
||||
{
|
||||
ui_event event = { UI_EVENT_NONE };
|
||||
event.event_type = UI_EVENT_MOUSE_DOWN;
|
||||
event.target = target;
|
||||
event.mouse_x = x;
|
||||
event.mouse_y = y;
|
||||
ui_input_push_event(machine, event);
|
||||
}
|
||||
/* mouse position/info */
|
||||
render_target * m_current_mouse_target;
|
||||
INT32 m_current_mouse_x;
|
||||
INT32 m_current_mouse_y;
|
||||
bool m_current_mouse_down;
|
||||
|
||||
/* popped states; ring buffer of ui_events */
|
||||
ui_event m_events[EVENT_QUEUE_SIZE];
|
||||
int m_events_start;
|
||||
int m_events_end;
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_input_push_mouse_down_event - pushes a mouse
|
||||
down event to the specified render_target
|
||||
-------------------------------------------------*/
|
||||
|
||||
static inline void ui_input_push_mouse_up_event(running_machine &machine, render_target *target, INT32 x, INT32 y)
|
||||
{
|
||||
ui_event event = { UI_EVENT_NONE };
|
||||
event.event_type = UI_EVENT_MOUSE_UP;
|
||||
event.target = target;
|
||||
event.mouse_x = x;
|
||||
event.mouse_y = y;
|
||||
ui_input_push_event(machine, event);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_input_push_mouse_double_click_event - pushes
|
||||
a mouse double-click event to the specified
|
||||
render_target
|
||||
-------------------------------------------------*/
|
||||
|
||||
static inline void ui_input_push_mouse_double_click_event(running_machine &machine, render_target *target, INT32 x, INT32 y)
|
||||
{
|
||||
ui_event event = { UI_EVENT_NONE };
|
||||
event.event_type = UI_EVENT_MOUSE_DOUBLE_CLICK;
|
||||
event.target = target;
|
||||
event.mouse_x = x;
|
||||
event.mouse_y = y;
|
||||
ui_input_push_event(machine, event);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_input_push_char_event - pushes a char event
|
||||
to the specified render_target
|
||||
-------------------------------------------------*/
|
||||
|
||||
static inline void ui_input_push_char_event(running_machine &machine, render_target *target, unicode_char ch)
|
||||
{
|
||||
ui_event event = { UI_EVENT_NONE };
|
||||
event.event_type = UI_EVENT_CHAR;
|
||||
event.target = target;
|
||||
event.ch = ch;
|
||||
ui_input_push_event(machine, event);
|
||||
}
|
||||
|
||||
bool m_initialized;
|
||||
};
|
||||
|
||||
#endif /* __UIINPUT_H__ */
|
||||
|
@ -1463,7 +1463,7 @@ static void handle_mouse(running_machine &machine)
|
||||
if (menu != nullptr)
|
||||
return;
|
||||
|
||||
mouse_target = ui_input_find_mouse(machine, &x, &y, &button);
|
||||
mouse_target = machine.ui_input().find_mouse(&x, &y, &button);
|
||||
|
||||
if (mouse_target == nullptr)
|
||||
return;
|
||||
@ -1671,7 +1671,7 @@ static void handle_editor(running_machine &machine)
|
||||
ui_event event;
|
||||
|
||||
/* loop while we have interesting events */
|
||||
while (ui_input_pop_event(machine, &event))
|
||||
while (machine.ui_input().pop_event(&event))
|
||||
{
|
||||
switch (event.event_type)
|
||||
{
|
||||
@ -1702,13 +1702,13 @@ static void handle_editor(running_machine &machine)
|
||||
if (cur_editor != nullptr)
|
||||
{
|
||||
render_editor(cur_editor);
|
||||
if (ui_input_pressed(machine, IPT_UI_SELECT))
|
||||
if (machine.ui_input().pressed(IPT_UI_SELECT))
|
||||
{
|
||||
process_string(focus_view, focus_view->editor.str.c_str());
|
||||
focus_view->editor.str = "";
|
||||
cur_editor = nullptr;
|
||||
}
|
||||
if (ui_input_pressed(machine, IPT_UI_CANCEL))
|
||||
if (machine.ui_input().pressed(IPT_UI_CANCEL))
|
||||
cur_editor = nullptr;
|
||||
}
|
||||
}
|
||||
@ -1725,7 +1725,7 @@ static void handle_menus(running_machine &machine)
|
||||
const ui_menu_event *event;
|
||||
|
||||
machine.render().ui_container().empty();
|
||||
ui_input_frame_update(machine);
|
||||
machine.ui_input().frame_update();
|
||||
if (menu != nullptr)
|
||||
{
|
||||
/* process the menu */
|
||||
@ -1738,7 +1738,7 @@ static void handle_menus(running_machine &machine)
|
||||
//ui_menu_stack_push(ui_menu_alloc(machine, menu->container, (ui_menu_handler_func)event->itemref,nullptr));
|
||||
CreateMainMenu(machine);
|
||||
}
|
||||
else if (ui_input_pressed(machine, IPT_UI_CONFIGURE))
|
||||
else if (machine.ui_input().pressed(IPT_UI_CONFIGURE))
|
||||
{
|
||||
menu_sel = menu->get_selection();
|
||||
global_free(menu);
|
||||
@ -1748,7 +1748,7 @@ static void handle_menus(running_machine &machine)
|
||||
else
|
||||
{
|
||||
/* turn on menus if requested */
|
||||
if (ui_input_pressed(machine, IPT_UI_CONFIGURE))
|
||||
if (machine.ui_input().pressed(IPT_UI_CONFIGURE))
|
||||
CreateMainMenu(machine);
|
||||
/* turn on editor if requested */
|
||||
//if (ui_input_pressed(machine, IPT_UI_UP) && focus_view->editor.active)
|
||||
@ -1848,7 +1848,7 @@ void debug_internal::wait_for_debugger(device_t &device, bool firststop)
|
||||
if(firststop)
|
||||
{
|
||||
debug_show_all();
|
||||
ui_input_reset(device.machine());
|
||||
device.machine().ui_input().reset();
|
||||
}
|
||||
//ui_update_and_render(device.machine(), device.machine().render().ui_container()());
|
||||
update_views();
|
||||
|
@ -1741,7 +1741,7 @@ void sdlinput_poll(running_machine &machine)
|
||||
devinfo->keyboard.state[OSD_SDL_INDEX_KEYSYM(&event.key.keysym)] = 0x80;
|
||||
#if (SDLMAME_SDL2)
|
||||
if (event.key.keysym.sym < 0x20)
|
||||
ui_input_push_char_event(machine, sdl_window_list->target(), event.key.keysym.sym);
|
||||
machine.ui_input().push_char_event(sdl_window_list->target(), event.key.keysym.sym);
|
||||
#else
|
||||
ui_input_push_char_event(machine, sdl_window_list->target(), (unicode_char) event.key.keysym.unicode);
|
||||
#endif
|
||||
@ -1845,14 +1845,14 @@ void sdlinput_poll(running_machine &machine)
|
||||
sdl_window_info *window = GET_FOCUS_WINDOW(&event.button);
|
||||
if (window != NULL && window->xy_to_render_target(event.button.x,event.button.y, &cx, &cy) )
|
||||
{
|
||||
ui_input_push_mouse_down_event(machine, window->target(), cx, cy);
|
||||
machine.ui_input().push_mouse_down_event(window->target(), cx, cy);
|
||||
// FIXME Parameter ?
|
||||
if ((click-last_click < 250)
|
||||
&& (cx >= last_x - 4 && cx <= last_x + 4)
|
||||
&& (cy >= last_y - 4 && cy <= last_y + 4) )
|
||||
{
|
||||
last_click = 0;
|
||||
ui_input_push_mouse_double_click_event(machine, window->target(), cx, cy);
|
||||
machine.ui_input().push_mouse_double_click_event(window->target(), cx, cy);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1879,7 +1879,7 @@ void sdlinput_poll(running_machine &machine)
|
||||
|
||||
if (window != NULL && window->xy_to_render_target(event.button.x,event.button.y, &cx, &cy) )
|
||||
{
|
||||
ui_input_push_mouse_up_event(machine, window->target(), cx, cy);
|
||||
machine.ui_input().push_mouse_up_event(window->target(), cx, cy);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1903,7 +1903,7 @@ void sdlinput_poll(running_machine &machine)
|
||||
sdl_window_info *window = GET_FOCUS_WINDOW(&event.motion);
|
||||
|
||||
if (window != NULL && window->xy_to_render_target(event.motion.x, event.motion.y, &cx, &cy) )
|
||||
ui_input_push_mouse_move_event(machine, window->target(), cx, cy);
|
||||
machine.ui_input().push_mouse_move_event(window->target(), cx, cy);
|
||||
}
|
||||
break;
|
||||
case SDL_JOYBALLMOTION:
|
||||
@ -1937,7 +1937,7 @@ void sdlinput_poll(running_machine &machine)
|
||||
if (window != NULL )
|
||||
{
|
||||
osd_uchar_from_osdchar(&result, event.text.text, 1);
|
||||
ui_input_push_char_event(machine, window->target(), result);
|
||||
machine.ui_input().push_char_event(window->target(), result);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1954,7 +1954,7 @@ void sdlinput_poll(running_machine &machine)
|
||||
machine.schedule_exit();
|
||||
break;
|
||||
case SDL_WINDOWEVENT_LEAVE:
|
||||
ui_input_push_mouse_leave_event(machine, window->target());
|
||||
machine.ui_input().push_mouse_leave_event(window->target());
|
||||
app_has_mouse_focus = 0;
|
||||
break;
|
||||
case SDL_WINDOWEVENT_MOVED:
|
||||
|
@ -509,7 +509,7 @@ static void check_osd_inputs(running_machine &machine)
|
||||
sdl_window_info *window = sdlinput_get_focus_window();
|
||||
|
||||
// check for toggling fullscreen mode
|
||||
if (ui_input_pressed(machine, IPT_OSD_1))
|
||||
if (machine.ui_input().pressed(IPT_OSD_1))
|
||||
{
|
||||
sdl_window_info *curwin = sdl_window_list;
|
||||
|
||||
@ -520,14 +520,14 @@ static void check_osd_inputs(running_machine &machine)
|
||||
}
|
||||
}
|
||||
|
||||
if (ui_input_pressed(machine, IPT_OSD_2))
|
||||
if (machine.ui_input().pressed(IPT_OSD_2))
|
||||
{
|
||||
//FIXME: on a per window basis
|
||||
video_config.fullstretch = !video_config.fullstretch;
|
||||
machine.ui().popup_time(1, "Uneven stretch %s", video_config.fullstretch? "enabled":"disabled");
|
||||
}
|
||||
|
||||
if (ui_input_pressed(machine, IPT_OSD_4))
|
||||
if (machine.ui_input().pressed(IPT_OSD_4))
|
||||
{
|
||||
//FIXME: on a per window basis
|
||||
video_config.keepaspect = !video_config.keepaspect;
|
||||
@ -536,17 +536,17 @@ static void check_osd_inputs(running_machine &machine)
|
||||
|
||||
#if (USE_OPENGL || SDLMAME_SDL2)
|
||||
//FIXME: on a per window basis
|
||||
if (ui_input_pressed(machine, IPT_OSD_5))
|
||||
if (machine.ui_input().pressed(IPT_OSD_5))
|
||||
{
|
||||
video_config.filter = !video_config.filter;
|
||||
machine.ui().popup_time(1, "Filter %s", video_config.filter? "enabled":"disabled");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ui_input_pressed(machine, IPT_OSD_6))
|
||||
if (machine.ui_input().pressed(IPT_OSD_6))
|
||||
window->modify_prescale(-1);
|
||||
|
||||
if (ui_input_pressed(machine, IPT_OSD_7))
|
||||
if (machine.ui_input().pressed(IPT_OSD_7))
|
||||
window->modify_prescale(1);
|
||||
}
|
||||
|
||||
|
@ -323,19 +323,19 @@ finishit:
|
||||
static void check_osd_inputs(running_machine &machine)
|
||||
{
|
||||
// check for toggling fullscreen mode
|
||||
if (ui_input_pressed(machine, IPT_OSD_1))
|
||||
if (machine.ui_input().pressed(IPT_OSD_1))
|
||||
winwindow_toggle_full_screen();
|
||||
|
||||
// check for taking fullscreen snap
|
||||
if (ui_input_pressed(machine, IPT_OSD_2))
|
||||
if (machine.ui_input().pressed(IPT_OSD_2))
|
||||
winwindow_take_snap();
|
||||
|
||||
// check for taking fullscreen video
|
||||
if (ui_input_pressed(machine, IPT_OSD_3))
|
||||
if (machine.ui_input().pressed(IPT_OSD_3))
|
||||
winwindow_take_video();
|
||||
|
||||
// check for taking fullscreen video
|
||||
if (ui_input_pressed(machine, IPT_OSD_4))
|
||||
if (machine.ui_input().pressed(IPT_OSD_4))
|
||||
winwindow_toggle_fsfx();
|
||||
}
|
||||
|
||||
|
@ -1292,17 +1292,20 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR
|
||||
|
||||
// input events
|
||||
case WM_MOUSEMOVE:
|
||||
ui_input_push_mouse_move_event(window->machine(), window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
|
||||
if (window->machine().phase() != MACHINE_PHASE_RUNNING) break;
|
||||
window->machine().ui_input().push_mouse_move_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
|
||||
break;
|
||||
|
||||
case WM_MOUSELEAVE:
|
||||
ui_input_push_mouse_leave_event(window->machine(), window->m_target);
|
||||
if (window->machine().phase() != MACHINE_PHASE_RUNNING) break;
|
||||
window->machine().ui_input().push_mouse_leave_event(window->m_target);
|
||||
break;
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
{
|
||||
if (window->machine().phase() != MACHINE_PHASE_RUNNING) break;
|
||||
DWORD ticks = GetTickCount();
|
||||
ui_input_push_mouse_down_event(window->machine(), window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
|
||||
window->machine().ui_input().push_mouse_down_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
|
||||
|
||||
// check for a double-click
|
||||
if (ticks - window->m_lastclicktime < GetDoubleClickTime() &&
|
||||
@ -1310,7 +1313,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR
|
||||
GET_Y_LPARAM(lparam) >= window->m_lastclicky - 4 && GET_Y_LPARAM(lparam) <= window->m_lastclicky + 4)
|
||||
{
|
||||
window->m_lastclicktime = 0;
|
||||
ui_input_push_mouse_double_click_event(window->machine(), window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
|
||||
window->machine().ui_input().push_mouse_double_click_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1322,11 +1325,13 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR
|
||||
}
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
ui_input_push_mouse_up_event(window->machine(), window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
|
||||
if (window->machine().phase() != MACHINE_PHASE_RUNNING) break;
|
||||
window->machine().ui_input().push_mouse_up_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
|
||||
break;
|
||||
|
||||
case WM_CHAR:
|
||||
ui_input_push_char_event(window->machine(), window->m_target, (unicode_char) wparam);
|
||||
if (window->machine().phase() != MACHINE_PHASE_RUNNING) break;
|
||||
window->machine().ui_input().push_char_event(window->m_target, (unicode_char) wparam);
|
||||
break;
|
||||
|
||||
// pause the system when we start a menu or resize
|
||||
|
Loading…
Reference in New Issue
Block a user