mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 09:48:51 +01:00
enable key repeat at menu launch
Signed-off-by: Vincent-FK <vincent.buso@funkey-project.com>
This commit is contained in:
parent
b95b326352
commit
997a7acd58
@ -51,7 +51,7 @@ if(WIN32)
|
||||
find_package(SDL_gfx REQUIRED )
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
#find_package(X11)
|
||||
find_package(X11)
|
||||
else()
|
||||
include(FindPkgConfig)
|
||||
#pkg_search_module(SDL2 REQUIRED sdl2)
|
||||
@ -73,7 +73,7 @@ if(APPLE)
|
||||
find_package(SDL REQUIRED )
|
||||
endif()
|
||||
|
||||
#find_package(X11)
|
||||
find_package(X11)
|
||||
endif()
|
||||
|
||||
set(RETROFE_INCLUDE_DIRS
|
||||
|
||||
@ -37,6 +37,8 @@
|
||||
#define MENU_FONT_NAME_SMALL_INFO "/usr/games/menu_resources/OpenSans-Regular.ttf"
|
||||
#define MENU_FONT_SIZE_SMALL_INFO 13
|
||||
#define MENU_PNG_BG_PATH "/usr/games/menu_resources/zone_bg.png"
|
||||
#define MENU_PNG_ARROW_TOP_PATH "/usr/games/menu_resources/arrow_top.png"
|
||||
#define MENU_PNG_ARROW_BOTTOM_PATH "/usr/games/menu_resources/arrow_bottom.png"
|
||||
|
||||
#define GRAY_MAIN_R 85
|
||||
#define GRAY_MAIN_G 85
|
||||
@ -61,6 +63,8 @@ SDL_Surface ** MenuMode::menu_zone_surfaces = NULL;
|
||||
int * MenuMode::idx_menus = NULL;
|
||||
int MenuMode::nb_menu_zones = 0;
|
||||
int MenuMode::stop_menu_loop = 0;
|
||||
SDL_Surface *img_arrow_top;
|
||||
SDL_Surface *img_arrow_bottom;
|
||||
|
||||
SDL_Color MenuMode::text_color = {GRAY_MAIN_R, GRAY_MAIN_G, GRAY_MAIN_B};
|
||||
int MenuMode::padding_y_from_center_menu_zone = 18;
|
||||
@ -113,11 +117,15 @@ void MenuMode::init( )
|
||||
}
|
||||
|
||||
|
||||
/// ------ Save prev key repeat params and set new Key repeat -------
|
||||
/*SDL_GetKeyRepeat(&backup_key_repeat_delay, &backup_key_repeat_interval);
|
||||
if(SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL)){
|
||||
MENU_ERROR_PRINTF("ERROR with SDL_EnableKeyRepeat: %s\n", SDL_GetError());
|
||||
}*/
|
||||
/// ------ Load arrows imgs -------
|
||||
img_arrow_top = IMG_Load(MENU_PNG_ARROW_TOP_PATH);
|
||||
if(!img_arrow_top) {
|
||||
MENU_ERROR_PRINTF("ERROR IMG_Load: %s\n", IMG_GetError());
|
||||
}
|
||||
img_arrow_bottom = IMG_Load(MENU_PNG_ARROW_BOTTOM_PATH);
|
||||
if(!img_arrow_bottom) {
|
||||
MENU_ERROR_PRINTF("ERROR IMG_Load: %s\n", IMG_GetError());
|
||||
}
|
||||
|
||||
/// ------ Init menu zones ------
|
||||
init_menu_zones();
|
||||
@ -147,10 +155,9 @@ void MenuMode::end( )
|
||||
SDL_FreeSurface(backup_hw_screen);
|
||||
}
|
||||
|
||||
/// ------ reset initial key repeat values ------
|
||||
/*if(SDL_EnableKeyRepeat(backup_key_repeat_delay, backup_key_repeat_interval)){
|
||||
MENU_ERROR_PRINTF("ERROR with SDL_EnableKeyRepeat: %s\n", SDL_GetError());
|
||||
}*/
|
||||
SDL_FreeSurface(img_arrow_top);
|
||||
SDL_FreeSurface(img_arrow_bottom);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -369,6 +376,12 @@ void MenuMode::init_menu_system_values(){
|
||||
}
|
||||
}
|
||||
|
||||
/// ------ Save prev key repeat params and set new Key repeat -------
|
||||
SDL_GetKeyRepeat(&backup_key_repeat_delay, &backup_key_repeat_interval);
|
||||
if(SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL)){
|
||||
MENU_ERROR_PRINTF("ERROR with SDL_EnableKeyRepeat: %s\n", SDL_GetError());
|
||||
}
|
||||
|
||||
/// Get save slot from game
|
||||
savestate_slot = (savestate_slot%MAX_SAVE_SLOTS); // security
|
||||
}
|
||||
@ -880,5 +893,10 @@ void MenuMode::launch( )
|
||||
/// --------- reset screen refresh ---------
|
||||
screen_refresh = 0;
|
||||
}
|
||||
|
||||
/// ------ Reset prev key repeat params -------
|
||||
if(SDL_EnableKeyRepeat(backup_key_repeat_delay, backup_key_repeat_interval)){
|
||||
MENU_ERROR_PRINTF("ERROR with SDL_EnableKeyRepeat: %s\n", SDL_GetError());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ typedef enum{
|
||||
MENU_TYPE_LOAD,
|
||||
MENU_TYPE_ASPECT_RATIO,
|
||||
MENU_TYPE_EXIT,
|
||||
MENU_TYPE_USB,
|
||||
MENU_TYPE_POWERDOWN,
|
||||
NB_MENU_TYPES,
|
||||
} ENUM_MENU_TYPE;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user