mirror of
https://github.com/libretro/RetroArch
synced 2025-04-02 07:20:34 +00:00
(Menu) Implement wheel up/down - will need kivutar to implement this
better
This commit is contained in:
parent
b93b9d8b58
commit
0ab0fdf709
@ -408,6 +408,7 @@ static void udev_input_poll(void *data)
|
|||||||
udev_input_t *udev = (udev_input_t*)data;
|
udev_input_t *udev = (udev_input_t*)data;
|
||||||
|
|
||||||
udev->mouse_x = udev->mouse_y = 0;
|
udev->mouse_x = udev->mouse_y = 0;
|
||||||
|
udev->mouse_wu = udev->mouse_wd = 0;
|
||||||
|
|
||||||
while (udev_input_hotplug_available(udev))
|
while (udev_input_hotplug_available(udev))
|
||||||
udev_input_handle_hotplug(udev);
|
udev_input_handle_hotplug(udev);
|
||||||
|
@ -562,9 +562,10 @@ static int action_iterate_message(const char *label, unsigned action)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mouse_iterate(unsigned action)
|
static int mouse_iterate(unsigned *action)
|
||||||
{
|
{
|
||||||
const struct retro_keybind *binds[MAX_USERS];
|
const struct retro_keybind *binds[MAX_USERS];
|
||||||
|
bool wheel_is_up = false, wheel_is_down = false;
|
||||||
menu_handle_t *menu = menu_driver_resolve();
|
menu_handle_t *menu = menu_driver_resolve();
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return -1;
|
return -1;
|
||||||
@ -572,6 +573,11 @@ static int mouse_iterate(unsigned action)
|
|||||||
if (!menu->mouse.enable)
|
if (!menu->mouse.enable)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
wheel_is_up = driver.input->input_state(driver.input_data,
|
||||||
|
binds, 0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_WHEELUP);
|
||||||
|
wheel_is_down = driver.input->input_state(driver.input_data,
|
||||||
|
binds, 0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_WHEELDOWN);
|
||||||
|
|
||||||
menu->mouse.dx = driver.input->input_state(driver.input_data,
|
menu->mouse.dx = driver.input->input_state(driver.input_data,
|
||||||
binds, 0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X);
|
binds, 0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X);
|
||||||
menu->mouse.dy = driver.input->input_state(driver.input_data,
|
menu->mouse.dy = driver.input->input_state(driver.input_data,
|
||||||
@ -589,14 +595,15 @@ static int mouse_iterate(unsigned action)
|
|||||||
if (menu->mouse.y > menu->frame_buf.height - 5)
|
if (menu->mouse.y > menu->frame_buf.height - 5)
|
||||||
menu->mouse.y = menu->frame_buf.height - 5;
|
menu->mouse.y = menu->frame_buf.height - 5;
|
||||||
|
|
||||||
|
|
||||||
menu->mouse.left = driver.input->input_state(driver.input_data,
|
menu->mouse.left = driver.input->input_state(driver.input_data,
|
||||||
binds, 0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT);
|
binds, 0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT);
|
||||||
|
|
||||||
menu->mouse.right = driver.input->input_state(driver.input_data,
|
menu->mouse.right = driver.input->input_state(driver.input_data,
|
||||||
binds, 0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_RIGHT);
|
binds, 0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_RIGHT);
|
||||||
|
|
||||||
menu->mouse.wheelup = menu->mouse.y == 5;
|
menu->mouse.wheelup = wheel_is_up || (menu->mouse.y == 5);
|
||||||
menu->mouse.wheeldown = menu->mouse.y == menu->frame_buf.height - 5;
|
menu->mouse.wheeldown = wheel_is_down || (menu->mouse.y == menu->frame_buf.height - 5);
|
||||||
|
|
||||||
if (menu->mouse.dx != 0 || menu->mouse.dy !=0 || menu->mouse.left)
|
if (menu->mouse.dx != 0 || menu->mouse.dy !=0 || menu->mouse.left)
|
||||||
g_runloop.frames.video.current.menu.animation.is_active = true;
|
g_runloop.frames.video.current.menu.animation.is_active = true;
|
||||||
@ -622,7 +629,7 @@ static int action_iterate_main(const char *label, unsigned action)
|
|||||||
menu_list_get_at_offset(menu->menu_list->selection_buf,
|
menu_list_get_at_offset(menu->menu_list->selection_buf,
|
||||||
menu->navigation.selection_ptr, &path_offset, &label_offset, &type_offset);
|
menu->navigation.selection_ptr, &path_offset, &label_offset, &type_offset);
|
||||||
|
|
||||||
mouse_iterate(action);
|
mouse_iterate(&action);
|
||||||
|
|
||||||
if (!strcmp(label, "help"))
|
if (!strcmp(label, "help"))
|
||||||
return action_iterate_help(label, action);
|
return action_iterate_help(label, action);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user