diff --git a/RetroFE/Source/CMakeLists.txt b/RetroFE/Source/CMakeLists.txt index 3d891a8..54dca20 100755 --- a/RetroFE/Source/CMakeLists.txt +++ b/RetroFE/Source/CMakeLists.txt @@ -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 diff --git a/RetroFE/Source/Menu/MenuMode.cpp b/RetroFE/Source/Menu/MenuMode.cpp index 2ae5ff2..4d66cba 100644 --- a/RetroFE/Source/Menu/MenuMode.cpp +++ b/RetroFE/Source/Menu/MenuMode.cpp @@ -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; } diff --git a/RetroFE/Source/Menu/MenuMode.h b/RetroFE/Source/Menu/MenuMode.h index 73ad66e..d13bd80 100644 --- a/RetroFE/Source/Menu/MenuMode.h +++ b/RetroFE/Source/Menu/MenuMode.h @@ -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;