summary refs log tree commit diff stats
path: root/src/marathon.c
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-06-02 18:29:57 -0400
committerCharadon <dev@iotib.net>2022-06-02 18:29:57 -0400
commit2dd8b8b6e66aa7e47da42912b0ca07ed8d7f0c23 (patch)
tree61c0defcc1f8f54f47759f04f41883e7343a096d /src/marathon.c
parent6a98c8dd4c10195e7b71602b15554bdc82ac0153 (diff)
downloadPong-C-2dd8b8b6e66aa7e47da42912b0ca07ed8d7f0c23.tar.gz
QOL stuff and upped to version 0.2
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);