mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 18:50:29 +00:00
add fast scrolling to settings menus
This commit is contained in:
parent
95690b9034
commit
0047aa9aaf
@ -191,7 +191,7 @@ static int menu_settings_iterate(unsigned action,
|
||||
{
|
||||
const char *path = NULL;
|
||||
const char *label = NULL;
|
||||
unsigned type = 0;
|
||||
unsigned type = 0, scroll_speed = 0;
|
||||
|
||||
driver.menu->frame_buf_pitch = driver.menu->width * 2;
|
||||
|
||||
@ -201,19 +201,23 @@ static int menu_settings_iterate(unsigned action,
|
||||
if (driver.menu->need_refresh && action != MENU_ACTION_MESSAGE)
|
||||
action = MENU_ACTION_REFRESH;
|
||||
|
||||
scroll_speed = (max(driver.menu->scroll_accel, 2) - 2) / 4 + 1;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case MENU_ACTION_UP:
|
||||
if (driver.menu->selection_ptr > 0)
|
||||
menu_navigation_decrement(driver.menu);
|
||||
if (driver.menu->selection_ptr >= scroll_speed)
|
||||
menu_navigation_set(driver.menu,
|
||||
driver.menu->selection_ptr - scroll_speed);
|
||||
else
|
||||
menu_navigation_set(driver.menu,
|
||||
menu_list_get_size(driver.menu->menu_list) - 1);
|
||||
break;
|
||||
|
||||
case MENU_ACTION_DOWN:
|
||||
if ((driver.menu->selection_ptr + 1) < (menu_list_get_size(driver.menu->menu_list)))
|
||||
menu_navigation_increment(driver.menu);
|
||||
if (driver.menu->selection_ptr + scroll_speed < (menu_list_get_size(driver.menu->menu_list)))
|
||||
menu_navigation_set(driver.menu,
|
||||
driver.menu->selection_ptr + scroll_speed);
|
||||
else
|
||||
menu_navigation_clear(driver.menu, false);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user