aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sdl/action.c2
-rw-r--r--src/sdl/action.h1
-rw-r--r--src/sdl/main.c10
3 files changed, 13 insertions, 0 deletions
diff --git a/src/sdl/action.c b/src/sdl/action.c
index 72b6fb2..09141a9 100644
--- a/src/sdl/action.c
+++ b/src/sdl/action.c
@@ -72,6 +72,8 @@ get_key_action(
return (action_t) { .type = ACTION_ZOOM_IN, .data = 1 };
case SDLK_MINUS:
return (action_t) { .type = ACTION_ZOOM_OUT, .data = -1 };
+ case SDLK_F11:
+ return (action_t) { .type = ACTION_FULLSCREEN };
default:
return (action_t) { .type = ACTION_NONE };
}
diff --git a/src/sdl/action.h b/src/sdl/action.h
index 4713f62..e28f9ce 100644
--- a/src/sdl/action.h
+++ b/src/sdl/action.h
@@ -17,6 +17,7 @@ typedef enum {
ACTION_NEXT,
ACTION_SOLVE,
ACTION_RESET,
+ ACTION_FULLSCREEN,
ACTION_LAST,
} action_type_t;
diff --git a/src/sdl/main.c b/src/sdl/main.c
index 16f9a46..8d7fdff 100644
--- a/src/sdl/main.c
+++ b/src/sdl/main.c
@@ -141,6 +141,7 @@ int main(int argc, char *argv[]) {
die("TTF_OpenFontIndex(): %s", TTF_GetError());
}
+ bool is_fullscreen = false;
bool done = false;
SDL_Event ev;
while (!done) {
@@ -232,6 +233,15 @@ int main(int argc, char *argv[]) {
}
break;
+ case ACTION_FULLSCREEN:
+ if (SDL_SetWindowFullscreen(win, is_fullscreen ? 0 : SDL_WINDOW_FULLSCREEN_DESKTOP)) {
+ die("SDL_SetWindowFullscreen(): %s", SDL_GetError());
+ }
+
+ // toggle flag
+ is_fullscreen = !is_fullscreen;
+
+ break;
default:
// ignore
break;