diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/sdl2/sdl.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/sdl2/sdl.c b/modules/sdl2/sdl.c index aefe0ca..9b3f27e 100644 --- a/modules/sdl2/sdl.c +++ b/modules/sdl2/sdl.c @@ -76,6 +76,32 @@ static void sdl_reset(struct vidisp_st *st) } +static void handle_events(struct vidisp_st *st) +{ + SDL_Event event; + + while (SDL_PollEvent(&event)) { + + if (event.type == SDL_KEYDOWN) { + + switch (event.key.keysym.sym) { + + case SDLK_f: + /* press key 'f' to toggle fullscreen */ + st->fullscreen = !st->fullscreen; + info("sdl: %sable fullscreen mode\n", + st->fullscreen ? "en" : "dis"); + sdl_reset(st); + break; + + default: + break; + } + } + } +} + + static void destructor(void *arg) { struct vidisp_st *st = arg; @@ -246,6 +272,8 @@ static int display(struct vidisp_st *st, const char *title, /* Update the screen! */ SDL_RenderPresent(st->renderer); + handle_events(st); + return 0; } |