mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Add RGUI scroll acceleration.
This commit is contained in:
parent
1c9bbb9333
commit
b72996da86
@ -621,6 +621,7 @@ bool menu_iterate(void)
|
||||
{
|
||||
first_held = false;
|
||||
rgui->trigger_state = input_state;
|
||||
rgui->scroll_accel = min(rgui->scroll_accel + 1, 64);
|
||||
}
|
||||
|
||||
initial_held = false;
|
||||
@ -629,6 +630,7 @@ bool menu_iterate(void)
|
||||
{
|
||||
first_held = false;
|
||||
initial_held = true;
|
||||
rgui->scroll_accel = 0;
|
||||
}
|
||||
|
||||
rgui->delay_count++;
|
||||
|
@ -290,6 +290,7 @@ typedef struct
|
||||
// Rebuilt when parsing directory.
|
||||
size_t scroll_indices[2 * (26 + 2) + 1];
|
||||
unsigned scroll_indices_size;
|
||||
unsigned scroll_accel;
|
||||
|
||||
char base_path[PATH_MAX];
|
||||
char default_glslp[PATH_MAX];
|
||||
|
@ -1111,32 +1111,34 @@ static int rgui_iterate(void *data, unsigned action)
|
||||
if (rgui->need_refresh && action != RGUI_ACTION_MESSAGE)
|
||||
action = RGUI_ACTION_NOOP;
|
||||
|
||||
unsigned scroll_speed = (max(rgui->scroll_accel, 4) - 4) / 4 + 1;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case RGUI_ACTION_UP:
|
||||
if (rgui->selection_ptr > 0)
|
||||
rgui->selection_ptr--;
|
||||
if (rgui->selection_ptr >= scroll_speed)
|
||||
rgui->selection_ptr -= scroll_speed;
|
||||
else
|
||||
rgui->selection_ptr = rgui->selection_buf->size - 1;
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_DOWN:
|
||||
if (rgui->selection_ptr + 1 < rgui->selection_buf->size)
|
||||
rgui->selection_ptr++;
|
||||
if (rgui->selection_ptr + scroll_speed < rgui->selection_buf->size)
|
||||
rgui->selection_ptr += scroll_speed;
|
||||
else
|
||||
rgui->selection_ptr = 0;
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_LEFT:
|
||||
if (rgui->selection_ptr > 8)
|
||||
rgui->selection_ptr -= 8;
|
||||
if (rgui->selection_ptr > 8 * scroll_speed)
|
||||
rgui->selection_ptr -= 8 * scroll_speed;
|
||||
else
|
||||
rgui->selection_ptr = 0;
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_RIGHT:
|
||||
if (rgui->selection_ptr + 8 < rgui->selection_buf->size)
|
||||
rgui->selection_ptr += 8;
|
||||
if (rgui->selection_ptr + 8 * scroll_speed < rgui->selection_buf->size)
|
||||
rgui->selection_ptr += 8 * scroll_speed;
|
||||
else
|
||||
rgui->selection_ptr = rgui->selection_buf->size - 1;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user