about summary refs log tree commit diff stats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main.c b/src/main.c
index e2e6308..efd6dd5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,5 +1,4 @@
 #include "pong.h"
-#include <SDL2/SDL_atomic.h>
 #include <raylib.h>
 
 int Difficulty = 1;
@@ -15,10 +14,14 @@ SDL_atomic_t AudioInitializing;
 int AudioQueue[20];
 
 void set_screen_mode() {
+	ClearWindowState(FLAG_VSYNC_HINT);
+	ClearWindowState(FLAG_WINDOW_TOPMOST);
+	ClearWindowState(FLAG_WINDOW_UNDECORATED);
+	ClearWindowState(FLAG_FULLSCREEN_MODE);
 	switch(GlobalSettings.Fullscreen) {
 		case 1: //Real Fullscreen is fickle as fuck. So it needs a timeout.
 			SetWindowSize(GetMonitorWidth(GetCurrentMonitor()), GetMonitorHeight(GetCurrentMonitor()));
-			int Timeout = SDL_AtomicGet(&Ticks)+100;
+			int Timeout = SDL_AtomicGet(&Ticks)+300; //Set the timeout for 5 seconds.
 			while(GetScreenHeight() != GetMonitorHeight(GetCurrentMonitor())) {
 				BeginDrawing();
 				EndDrawing();
@@ -26,6 +29,7 @@ void set_screen_mode() {
 					goto FullScreenFailed;
 				}
 			}
+			SetWindowState(FLAG_VSYNC_HINT);
 			SetWindowState(FLAG_FULLSCREEN_MODE);
 			break;
 		case 2:
@@ -36,9 +40,6 @@ void set_screen_mode() {
 			break;
 		default:
 			FullScreenFailed:
-			ClearWindowState(FLAG_WINDOW_TOPMOST);
-			ClearWindowState(FLAG_WINDOW_UNDECORATED);
-			ClearWindowState(FLAG_FULLSCREEN_MODE);
 			SetWindowSize(1280, 720);
 			SetWindowPosition(GetMonitorHeight(GetCurrentMonitor())/5, GetMonitorHeight(GetCurrentMonitor())/5);
 			break;
@@ -46,9 +47,9 @@ void set_screen_mode() {
 	return;
 }
 
-int internal_clock() {
+static int internal_clock() {
 	const struct timespec Delay = {
-		0, 20000000
+		0, 16666666
 	};
 	struct timespec Remaining;
 	while(GameGoing == true) {
@@ -58,7 +59,7 @@ int internal_clock() {
 	return(0);
 }
 
-int audio() {
+static int audio() {
 	int i;
 	Mix_Init(0);
 	Mix_OpenAudio(48000, MIX_DEFAULT_FORMAT, 2, 1024);