mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-18 17:04:34 +00:00
Create menu_input_ctl
This commit is contained in:
parent
e21e21647e
commit
3fb90871f6
@ -245,12 +245,16 @@ static void glui_render(void)
|
||||
|
||||
if (settings->menu.mouse.enable)
|
||||
{
|
||||
int16_t mouse_y = menu_input_pointer_state(MENU_MOUSE_Y_AXIS);
|
||||
bool mouse_scrolldown, mouse_scrollup;
|
||||
int16_t mouse_y = menu_input_pointer_state(MENU_MOUSE_Y_AXIS);
|
||||
|
||||
if (menu_input->mouse.scrolldown)
|
||||
menu_input_ctl(MENU_CTL_MOUSE_SCROLL_DOWN, &mouse_scrolldown);
|
||||
menu_input_ctl(MENU_CTL_MOUSE_SCROLL_UP, &mouse_scrollup);
|
||||
|
||||
if (mouse_scrolldown)
|
||||
menu->scroll_y += 10;
|
||||
|
||||
if (menu_input->mouse.scrollup)
|
||||
if (mouse_scrollup)
|
||||
menu->scroll_y -= 10;
|
||||
|
||||
menu_input->mouse.ptr =
|
||||
|
@ -454,11 +454,16 @@ static void rgui_render(void)
|
||||
|
||||
if (settings->menu.mouse.enable)
|
||||
{
|
||||
if (menu_input->mouse.scrolldown
|
||||
bool mouse_scrolldown, mouse_scrollup;
|
||||
|
||||
menu_input_ctl(MENU_CTL_MOUSE_SCROLL_DOWN, &mouse_scrolldown);
|
||||
menu_input_ctl(MENU_CTL_MOUSE_SCROLL_UP, &mouse_scrollup);
|
||||
|
||||
if (mouse_scrolldown
|
||||
&& (menu_entries_get_start() < menu_entries_get_end() - RGUI_TERM_HEIGHT))
|
||||
menu_entries_set_start(menu_entries_get_start() + 1);
|
||||
|
||||
if (menu_input->mouse.scrollup && (menu_entries_get_start() > 0))
|
||||
if (mouse_scrollup && (menu_entries_get_start() > 0))
|
||||
menu_entries_set_start(menu_entries_get_start() - 1);
|
||||
|
||||
menu_input->mouse.ptr = menu_input->mouse.y / 11 - 2 + menu_entries_get_start();
|
||||
|
@ -60,6 +60,32 @@ void menu_input_key_event(bool down, unsigned keycode,
|
||||
menu_entry_action(NULL, 0, MENU_ACTION_SEARCH);
|
||||
}
|
||||
|
||||
bool menu_input_ctl(enum menu_ctl_state state, void *data)
|
||||
{
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
|
||||
if (!menu_input)
|
||||
return false;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case MENU_CTL_MOUSE_SCROLL_DOWN:
|
||||
{
|
||||
bool *ptr = (bool*)data;
|
||||
*ptr = menu_input->mouse.scrolldown;
|
||||
}
|
||||
return true;
|
||||
case MENU_CTL_MOUSE_SCROLL_UP:
|
||||
{
|
||||
bool *ptr = (bool*)data;
|
||||
*ptr = menu_input->mouse.scrollup;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void menu_input_key_start_line(const char *label,
|
||||
const char *label_setting, unsigned type, unsigned idx,
|
||||
input_keyboard_line_complete_t cb)
|
||||
|
@ -73,6 +73,12 @@ enum menu_input_mouse_state
|
||||
MENU_MOUSE_Y_AXIS
|
||||
};
|
||||
|
||||
enum menu_ctl_state
|
||||
{
|
||||
MENU_CTL_MOUSE_SCROLL_DOWN = 0,
|
||||
MENU_CTL_MOUSE_SCROLL_UP
|
||||
};
|
||||
|
||||
enum mouse_action
|
||||
{
|
||||
MOUSE_ACTION_NONE = 0,
|
||||
@ -215,6 +221,8 @@ int16_t menu_input_pointer_state(enum menu_input_pointer_state state);
|
||||
|
||||
int16_t menu_input_mouse_state(enum menu_input_mouse_state state);
|
||||
|
||||
bool menu_input_ctl(enum menu_ctl_state state, void *data);
|
||||
|
||||
menu_input_t *menu_input_get_ptr(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
x
Reference in New Issue
Block a user