From 1aa1b17557dca5cc870caebcf20f2a24984460d7 Mon Sep 17 00:00:00 2001 From: Charadon Date: Wed, 8 Jun 2022 18:39:33 -0400 Subject: Fixed fullescreen mode --- src/main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 6a2ba9c..e2e6308 100644 --- a/src/main.c +++ b/src/main.c @@ -1,4 +1,6 @@ #include "pong.h" +#include +#include int Difficulty = 1; SDL_atomic_t Ticks; @@ -14,8 +16,16 @@ int AudioQueue[20]; void set_screen_mode() { switch(GlobalSettings.Fullscreen) { - case 1: + case 1: //Real Fullscreen is fickle as fuck. So it needs a timeout. SetWindowSize(GetMonitorWidth(GetCurrentMonitor()), GetMonitorHeight(GetCurrentMonitor())); + int Timeout = SDL_AtomicGet(&Ticks)+100; + while(GetScreenHeight() != GetMonitorHeight(GetCurrentMonitor())) { + BeginDrawing(); + EndDrawing(); + if(SDL_AtomicGet(&Ticks) >= Timeout) { //Default to windowed if fullscreen fails for whatever reason. + goto FullScreenFailed; + } + } SetWindowState(FLAG_FULLSCREEN_MODE); break; case 2: @@ -25,6 +35,7 @@ void set_screen_mode() { SetWindowSize(GetMonitorWidth(GetCurrentMonitor()), GetMonitorHeight(GetCurrentMonitor())); break; default: + FullScreenFailed: ClearWindowState(FLAG_WINDOW_TOPMOST); ClearWindowState(FLAG_WINDOW_UNDECORATED); ClearWindowState(FLAG_FULLSCREEN_MODE); -- cgit 1.4.1-2-gfad0