sdl2 fullscreen toggle
This commit is contained in:
parent
3ff9240636
commit
44a2dbfc3d
10
inc/lzy.h
10
inc/lzy.h
|
@ -442,6 +442,7 @@ static const SDL_Scancode sc[LZYK_COUNT] = {
|
|||
SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_UP,
|
||||
SDL_SCANCODE_DOWN, SDL_SCANCODE_Z, SDL_SCANCODE_X,
|
||||
};
|
||||
static const SDL_Scancode fullscreen_sc = SDL_SCANCODE_F11;
|
||||
static const char *error = NULL;
|
||||
static SDL_Window *window = NULL;
|
||||
static SDL_Renderer *renderer = NULL;
|
||||
|
@ -912,6 +913,15 @@ int LZY_PollEvent(LZY_Event *e) {
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
if (sdl_e.key.keysym.scancode ==
|
||||
fullscreen_sc) {
|
||||
const unsigned int flag =
|
||||
SDL_WINDOW_FULLSCREEN;
|
||||
const unsigned int fullscreen =
|
||||
SDL_GetWindowFlags(window) & flag;
|
||||
SDL_SetWindowFullscreen(window,
|
||||
!fullscreen);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue