mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 10:18:53 +01:00
add powering-off message
Signed-off-by: Vincent-FK <vincent.buso@funkey-project.com>
This commit is contained in:
parent
41288c5c25
commit
8532aa196e
@ -31,6 +31,7 @@ const key_names_s key_names[] = {
|
|||||||
sed 's/^#define \([^ \t]\+\)[ \t]*\([^\ \t]\+\)/ { \"\1\",\t\2 },/' /usr/include/linux/input.h
|
sed 's/^#define \([^ \t]\+\)[ \t]*\([^\ \t]\+\)/ { \"\1\",\t\2 },/' /usr/include/linux/input.h
|
||||||
*/
|
*/
|
||||||
{ "KEY_RESERVED", SDLK_UNKNOWN },
|
{ "KEY_RESERVED", SDLK_UNKNOWN },
|
||||||
|
{ "KEY_FIRST", SDLK_FIRST },
|
||||||
{ "Escape", SDLK_ESCAPE },
|
{ "Escape", SDLK_ESCAPE },
|
||||||
{ "1", SDLK_1 },
|
{ "1", SDLK_1 },
|
||||||
{ "2", SDLK_2 },
|
{ "2", SDLK_2 },
|
||||||
@ -236,7 +237,7 @@ bool UserInput::MapKey(std::string keyDescription, KeyCode_E key, bool required)
|
|||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
if (scanCode != SDLK_UNKNOWN)
|
if (scanCode != SDLK_UNKNOWN || !strcmp(token.c_str(),"SDLK_FIRST") )
|
||||||
{
|
{
|
||||||
Logger::write(Logger::ZONE_INFO, "Input", "Binding key " + configKey + ", Key Value: " + std::to_string(scanCode));
|
Logger::write(Logger::ZONE_INFO, "Input", "Binding key " + configKey + ", Key Value: " + std::to_string(scanCode));
|
||||||
keyHandlers_.push_back(std::pair<InputHandler *, KeyCode_E>(new KeyboardHandler(scanCode), key));
|
keyHandlers_.push_back(std::pair<InputHandler *, KeyCode_E>(new KeyboardHandler(scanCode), key));
|
||||||
|
|||||||
@ -515,13 +515,22 @@ void MenuMode::menu_screen_refresh(int menuItem, int prevItem, int scroll, uint8
|
|||||||
|
|
||||||
case MENU_TYPE_EXIT:
|
case MENU_TYPE_EXIT:
|
||||||
case MENU_TYPE_POWERDOWN:
|
case MENU_TYPE_POWERDOWN:
|
||||||
if(menu_confirmation){
|
if(menu_action){
|
||||||
sprintf(text_tmp, "Are you sure ?");
|
sprintf(text_tmp, "Shutting down...");
|
||||||
text_surface = TTF_RenderText_Blended(menu_info_font, text_tmp, text_color);
|
text_surface = TTF_RenderText_Blended(menu_info_font, text_tmp, text_color);
|
||||||
text_pos.x = (virtual_hw_screen->w - MENU_ZONE_WIDTH)/2 + (MENU_ZONE_WIDTH - text_surface->w)/2;
|
text_pos.x = (virtual_hw_screen->w - MENU_ZONE_WIDTH)/2 + (MENU_ZONE_WIDTH - text_surface->w)/2;
|
||||||
text_pos.y = virtual_hw_screen->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2 + 2*padding_y_from_center_menu_zone;
|
text_pos.y = virtual_hw_screen->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2 + 2*padding_y_from_center_menu_zone;
|
||||||
SDL_BlitSurface(text_surface, NULL, virtual_hw_screen, &text_pos);
|
SDL_BlitSurface(text_surface, NULL, virtual_hw_screen, &text_pos);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
if(menu_confirmation){
|
||||||
|
sprintf(text_tmp, "Are you sure ?");
|
||||||
|
text_surface = TTF_RenderText_Blended(menu_info_font, text_tmp, text_color);
|
||||||
|
text_pos.x = (virtual_hw_screen->w - MENU_ZONE_WIDTH)/2 + (MENU_ZONE_WIDTH - text_surface->w)/2;
|
||||||
|
text_pos.y = virtual_hw_screen->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2 + 2*padding_y_from_center_menu_zone;
|
||||||
|
SDL_BlitSurface(text_surface, NULL, virtual_hw_screen, &text_pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -597,6 +606,7 @@ void MenuMode::launch( )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SDLK_q:
|
case SDLK_q:
|
||||||
|
case SDLK_FIRST:
|
||||||
case SDLK_ESCAPE:
|
case SDLK_ESCAPE:
|
||||||
stop_menu_loop = 1;
|
stop_menu_loop = 1;
|
||||||
break;
|
break;
|
||||||
@ -809,6 +819,10 @@ void MenuMode::launch( )
|
|||||||
else if(idx_menus[menuItem] == MENU_TYPE_POWERDOWN){
|
else if(idx_menus[menuItem] == MENU_TYPE_POWERDOWN){
|
||||||
if(menu_confirmation){
|
if(menu_confirmation){
|
||||||
MENU_DEBUG_PRINTF("Powerdown - confirmed\n");
|
MENU_DEBUG_PRINTF("Powerdown - confirmed\n");
|
||||||
|
|
||||||
|
/// ------ Refresh Screen -------
|
||||||
|
menu_screen_refresh(menuItem, prevItem, scroll, menu_confirmation, 1);
|
||||||
|
|
||||||
/// ----- Shell cmd ----
|
/// ----- Shell cmd ----
|
||||||
sprintf(shell_cmd, "%s", SHELL_CMD_POWERDOWN);
|
sprintf(shell_cmd, "%s", SHELL_CMD_POWERDOWN);
|
||||||
fp = popen(shell_cmd, "r");
|
fp = popen(shell_cmd, "r");
|
||||||
|
|||||||
@ -441,8 +441,6 @@ void RetroFE::run( )
|
|||||||
}
|
}
|
||||||
|
|
||||||
float preloadTime = 0;
|
float preloadTime = 0;
|
||||||
int current_sdl_ticks = 0;
|
|
||||||
int process_time = 0;
|
|
||||||
|
|
||||||
// Force refresh variables
|
// Force refresh variables
|
||||||
#ifdef PERIOD_FORCE_REFRESH
|
#ifdef PERIOD_FORCE_REFRESH
|
||||||
@ -1137,6 +1135,14 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page )
|
|||||||
SDL_Event e;
|
SDL_Event e;
|
||||||
while ( SDL_PollEvent( &e ) )
|
while ( SDL_PollEvent( &e ) )
|
||||||
{
|
{
|
||||||
|
if ( e.type == SDL_QUIT )
|
||||||
|
{
|
||||||
|
printf("How dare you interrupt me!\n");
|
||||||
|
attract_.reset( );
|
||||||
|
state = RETROFE_QUIT_REQUEST;
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
input_.update(e);
|
input_.update(e);
|
||||||
/*if ( e.type == SDL_KEYDOWN && !e.key.repeat )
|
/*if ( e.type == SDL_KEYDOWN && !e.key.repeat )
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user