diff options
author | Charadon <dev@iotib.net> | 2022-06-08 18:39:33 -0400 |
---|---|---|
committer | Charadon <dev@iotib.net> | 2022-06-08 18:39:33 -0400 |
commit | 1aa1b17557dca5cc870caebcf20f2a24984460d7 (patch) | |
tree | b026d0b95c336cee57d07d39804aed6a57dd1542 /src | |
parent | bb347dde99572c03bf8937b75931a3ff6530324f (diff) | |
download | Pong-C-1aa1b17557dca5cc870caebcf20f2a24984460d7.tar.gz |
Fixed fullescreen mode
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 13 |
1 files changed, 12 insertions, 1 deletions
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 <SDL2/SDL_atomic.h> +#include <raylib.h> 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); |