Fast up and down menu scrolling

This commit is contained in:
Fabio Olimpieri 2017-01-15 16:19:14 +01:00
parent 228d0b06e6
commit 5a5bb1a737
2 changed files with 19 additions and 2 deletions

View File

@ -1239,6 +1239,17 @@ uint32_t menu_wait_key_press(int *joy_n_p)
if (!joy_keys_changed)
keys = 0;
//Quick scrolling
for (nr = 0; nr < ordenador.joystick_number; nr++) {
joy = ordenador.joystick_sdl[nr];
Sint16 axis3 = SDL_JoystickGetAxis(joy, 3);
if (axis3 < -15000 ) keys |= KEY_UP_FAST;
else if( axis3 > 15000 ) keys |= KEY_DOWN_FAST;
}
if (SDL_PollEvent(&ev))
{
switch(ev.type)
@ -1348,6 +1359,10 @@ static int menu_select_internal(SDL_Surface *screen,
{select_next(p_menu, 0, -1, 1);play_click(0);}
else if (keys & KEY_DOWN)
{select_next(p_menu, 0, 1, 1);play_click(0);}
else if (keys & KEY_UP_FAST)
{select_next(p_menu, 0, -1, 1);}
else if (keys & KEY_DOWN_FAST)
{select_next(p_menu, 0, 1, 1);}
else if (keys & KEY_PAGEUP)
{select_next(p_menu, 0, -19, 0);play_click(0);}
else if (keys & KEY_PAGEDOWN)

View File

@ -38,7 +38,9 @@
#define KEY_PAGEDOWN 64
#define KEY_PAGEUP 128
#define KEY_HELP 256
#define KEY_DESELECT 512
#define KEY_DESELECT 512
#define KEY_UP_FAST 1024
#define KEY_DOWN_FAST 2048
enum font {FONT_NORM, FONT_ALT};