diff options
author | Tuomas Virtanen <katajakasa@gmail.com> | 2016-01-17 23:50:22 +0200 |
---|---|---|
committer | Tuomas Virtanen <katajakasa@gmail.com> | 2016-01-17 23:50:22 +0200 |
commit | 34bc8e908a241f61b8d8ba31d6dbc4705d81f2af (patch) | |
tree | 6392569a5193abc34d755da0e1557193e98c7293 /examples | |
parent | 91d57e02d7d60d0333199bae58699d57dde03b79 (diff) |
Fullscreen support in example_video
Diffstat (limited to 'examples')
-rw-r--r-- | examples/example_video.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/examples/example_video.c b/examples/example_video.c index b36bbeb..915cbe8 100644 --- a/examples/example_video.c +++ b/examples/example_video.c @@ -10,7 +10,7 @@ * It is for example use only! */ -#define AUDIOBUFFER_SIZE (16384) +#define AUDIOBUFFER_SIZE (32768) void render_gui(SDL_Renderer *renderer, double percent) { @@ -207,6 +207,7 @@ int main(int argc, char *argv[]) { int size_w = 0, size_h = 0; SDL_RenderGetLogicalSize(renderer, &size_w, &size_h); bool gui_enabled = false; + bool fullscreen = false; while(run) { if(Kit_GetPlayerState(player) == KIT_STOPPED) { run = false; @@ -214,6 +215,7 @@ int main(int argc, char *argv[]) { } // Check for events + const Uint8 *state; while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_KEYUP: @@ -246,6 +248,19 @@ int main(int argc, char *argv[]) { } break; + case SDL_KEYDOWN: + // Find alt+enter + state = SDL_GetKeyboardState(NULL); + if(state[SDL_SCANCODE_RETURN] && state[SDL_SCANCODE_LALT]) { + if(!fullscreen) { + SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); + } else { + SDL_SetWindowFullscreen(window, 0); + } + fullscreen = !fullscreen; + } + break; + case SDL_MOUSEMOTION: mouse_x = event.motion.x; mouse_y = event.motion.y; |