aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2019-01-14 20:49:44 -0500
committerPaul Duncan <pabs@pablotron.org>2019-01-14 20:49:44 -0500
commitee2d66bbe27ad6647acd5956699a8b79fb2fbec6 (patch)
tree051f46748f34efc463ee080905cd6c92a0d3b4c3 /src
parentb637bf73d269ac42844d0482d8d79f8f3ce87926 (diff)
downloadsok-ee2d66bbe27ad6647acd5956699a8b79fb2fbec6.tar.bz2
sok-ee2d66bbe27ad6647acd5956699a8b79fb2fbec6.zip
add ACTION_FULLSCREEN
Diffstat (limited to 'src')
-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;