cli: add fullscreen toggle with alt-enter

This commit is contained in:
rofl0r 2021-10-25 04:04:09 +00:00
parent 9868c00fca
commit 09506c9a19
3 changed files with 10 additions and 6 deletions

View File

@ -497,8 +497,9 @@ int main(int argc, char ** argv) {
fprintf( stderr, "Window creation failed: %s\n", SDL_GetError( ) );
exit( -1);
}
ctrls_cfg.window = window;
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
uint32_t desmume_pixelformat = SDL_MasksToPixelFormatEnum(16, 0x001F, 0x03E0, 0x7C00, 0);

View File

@ -34,6 +34,7 @@ u16 keyboard_cfg[NB_KEYS];
u16 joypad_cfg[NB_KEYS];
u16 nbr_joy;
mouse_status mouse;
static int fullscreen;
static SDL_Joystick **open_joysticks = NULL;
@ -500,6 +501,12 @@ process_ctrls_event( SDL_Event& event,
break;
case SDL_KEYDOWN:
if ((event.key.keysym.sym == SDLK_RETURN) && (event.key.keysym.mod & KMOD_ALT)) {
SDL_SetWindowFullscreen(cfg->window, fullscreen ? 0 : SDL_WINDOW_FULLSCREEN);
fullscreen = !fullscreen;
break;
}
switch(event.key.keysym.sym){
case SDLK_LSHIFT:
shift_pressed |= 1;

View File

@ -91,13 +91,9 @@ struct ctrls_event_config {
int sdl_quit;
int boost;
int fake_mic;
#ifdef HAVE_GL_GL_H
GLuint *screen_texture;
void (*resize_cb)(u16 width, u16 height, GLuint *screen_texture);
#else
void *screen_texture;
void (*resize_cb)(u16 width, u16 height, void *screen_texture);
#endif
SDL_Window *window;
};
void load_default_config(const u32 kbCfg[]);