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.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 7d760b6..6a2ba9c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -12,6 +12,29 @@ SDL_atomic_t AudioInitializing;
 
 int AudioQueue[20];
 
+void set_screen_mode() {
+	switch(GlobalSettings.Fullscreen) {
+		case 1:
+			SetWindowSize(GetMonitorWidth(GetCurrentMonitor()), GetMonitorHeight(GetCurrentMonitor()));
+			SetWindowState(FLAG_FULLSCREEN_MODE);
+			break;
+		case 2:
+			SetWindowState(FLAG_WINDOW_TOPMOST);
+			SetWindowState(FLAG_WINDOW_UNDECORATED);
+			SetWindowPosition(0, 0);
+			SetWindowSize(GetMonitorWidth(GetCurrentMonitor()), GetMonitorHeight(GetCurrentMonitor()));
+			break;
+		default:
+			ClearWindowState(FLAG_WINDOW_TOPMOST);
+			ClearWindowState(FLAG_WINDOW_UNDECORATED);
+			ClearWindowState(FLAG_FULLSCREEN_MODE);
+			SetWindowSize(1280, 720);
+			SetWindowPosition(GetMonitorHeight(GetCurrentMonitor())/5, GetMonitorHeight(GetCurrentMonitor())/5);
+			break;
+	}
+	return;
+}
+
 int internal_clock() {
 	const struct timespec Delay = {
 		0, 20000000
@@ -109,6 +132,11 @@ int main(int argc, char *argv[]) {
 	SetWindowState(FLAG_WINDOW_RESIZABLE);
 	SetWindowMinSize(1280, 720);
 
+	//Settings declaration to prevent undefined behavior.
+	GlobalSettings.Fullscreen = 0;
+	GlobalSettings.SoundVolume = 0;
+	GlobalSettings.MusicVolume = 0;
+
 	//SDL Init
 	SDL_Init(SDL_INIT_AUDIO);
 
@@ -163,6 +191,8 @@ int main(int argc, char *argv[]) {
 		}
 	}
 	fclose(SettingsFile);
+	
+	set_screen_mode();
 
 	// Wait for audio to finish initializing.
 	struct timespec a = {