about summary refs log tree commit diff stats
path: root/src/marathon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/marathon.c')
-rw-r--r--src/marathon.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/marathon.c b/src/marathon.c
index 0ec4f71..9e05b7a 100644
--- a/src/marathon.c
+++ b/src/marathon.c
@@ -37,8 +37,11 @@ void marathon_main() {
         MainCamera.target = (Vector2){0, 0};
         MainCamera.offset = (Vector2){0, 0};
         MainCamera.rotation = 0;
-
-    while(!WindowShouldClose() && GameGoing == true) {
+    bool MarathonGoing = true;
+    while(MarathonGoing == true && GameGoing == true) {
+        if (WindowShouldClose()) { //Quit Game if the window is closed.
+            GameGoing = false;
+        }
         UpdateMusicStream(Background);
         snprintf(PlayerScore, 50, "Player: %d", Player.Score);
         MainCamera.zoom = GetScreenHeight()/720.0f;
@@ -56,6 +59,11 @@ void marathon_main() {
 			Player.Y = GetMouseY()-PaddleSprite.height/2.0f;
 			DisableCursor();
 		}
+        
+        // Leave game
+        if(IsKeyPressed(KEY_Q)) {
+            return;
+        }
 		
 		if(GetMouseY() < 0) {
 			SetMousePosition(0, 0);