diff options
author | Charadon <dev@iotib.net> | 2022-09-10 16:28:10 -0400 |
---|---|---|
committer | Charadon <dev@iotib.net> | 2022-09-10 16:28:10 -0400 |
commit | 056dbd9bfdd7b4855ff0632f1c0779121a971c7d (patch) | |
tree | 5721d5d111edf5b9aac0819c9e443c8c23010c48 /src | |
parent | c21912f0c4e821306ebee4979fb939438b461372 (diff) | |
download | Pong-C-056dbd9bfdd7b4855ff0632f1c0779121a971c7d.tar.gz |
Fixed issue where game wouldn't close when game should've.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 5 | ||||
-rw-r--r-- | src/title.c | 18 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/main.c b/src/main.c index 6b07e4e..c25de51 100644 --- a/src/main.c +++ b/src/main.c @@ -1,4 +1,5 @@ #include "pong.h" +#include <raylib.h> int Difficulty = 1; SDL_atomic_t Ticks; @@ -66,6 +67,10 @@ static int internal_clock() { SDL_AtomicAdd(&Ticks, 1); DeltaTime--; } + /* This will make sure no matter where you are in the game, it will close when it should. */ + if (WindowShouldClose()) { + GameGoing = false; + } } return(0); diff --git a/src/title.c b/src/title.c index f909a9e..5a5fecc 100644 --- a/src/title.c +++ b/src/title.c @@ -147,16 +147,16 @@ static void score_screen(Camera2D *MainCamera) { ClearBackground(BLACK); BeginMode2D(*MainCamera); DrawRectangle(0, 0, 1280, 720, (Color){20, 20, 20, 255}); - /* Scores */ - int a = 0; - int i = 0; - for (i = 1+(10*Page); i <= 10+(10*Page); i++, a++) { + /* Scores */ + int a = 0; + int i = 0; + for (i = 1+(10*Page); i <= 10+(10*Page); i++, a++) { if(Scores[i-1]->Name[0] != ' ') { - DrawText(TextFormat("%d. %s: %d", i, Scores[i-1]->Name, Scores[i-1]->Score), 460, 60+(50*a), 48, WHITE); - } else { - EndOfPages = true; - } - } + DrawText(TextFormat("%d. %s: %d", i, Scores[i-1]->Name, Scores[i-1]->Score), 460, 60+(50*a), 48, WHITE); + } else { + EndOfPages = true; + } + } /* Page Buttons */ if(CheckCollisionRecs(MouseCursor, PrevPage) && Page > 0) { DrawRectangleRec(PrevPage, RED); |