about summary refs log tree commit diff stats
path: root/src/title.c
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-06-12 17:25:43 -0400
committerCharadon <dev@iotib.net>2022-06-12 17:25:43 -0400
commit75186deaa18aab61a4d4236c6e4a20b79707de0e (patch)
treed28202b7959851fa1f2251130b31ba122c6bef47 /src/title.c
parent2fef65fbe758daffab758960719dbb088d264651 (diff)
downloadPong-C-75186deaa18aab61a4d4236c6e4a20b79707de0e.tar.gz
Finished All Scores Screen
Diffstat (limited to 'src/title.c')
-rw-r--r--src/title.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/title.c b/src/title.c
index 25e0112..808885a 100644
--- a/src/title.c
+++ b/src/title.c
@@ -144,7 +144,7 @@ static void score_screen(Camera2D *MainCamera) {
                     }
                 }
 		// Page Buttons
-		if(CheckCollisionRecs(MouseCursor, PrevPage)) {
+		if(CheckCollisionRecs(MouseCursor, PrevPage) && Page > 0) {
 			DrawRectangleRec(PrevPage, RED);
 			if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
 				if(Page > 0) {
@@ -161,15 +161,20 @@ static void score_screen(Camera2D *MainCamera) {
 		}
                 DrawText("<--", 5, 720-50, 48, WHITE);
                 DrawText("-->", 1280-70, 720-50, 48, WHITE);
+		//Exit Button
+		if(CheckCollisionRecs(MouseCursor, (Rectangle){0,0,42,120})) {
+			DrawRectangle(0, 0, 42, 120, RED);
+			if(IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
+				LookingAtScores = false;
+			}
+		}
+		DrawText("<", 0, 0, 128, WHITE);
 		// Cursor
                 DrawTexture(MouseCursorSprite, MouseCursor.x, MouseCursor.y, WHITE);
             EndMode2D();
         EndDrawing();
-        if(IsKeyPressed(KEY_Q)) {
-            return;
-        }
     }
-    
+    return;
 }
 
 static void settings(Camera2D *MainCamera, Mix_Music *TitleScreenMusic) {
@@ -461,7 +466,7 @@ int title_screen() {
                     }
                     char LeaderboardText[1024];
                     for (int i = 1; i <= 10; i++) {
-                        if(Top10[i-1].Name[0] != ' ') {
+                        if(Top10[i-1].Name[0] != '\0') { //If name is blank, that means we're at the end of the list.
                             snprintf(LeaderboardText, sizeof(LeaderboardText), "%d: %s : %d", i, Top10[i-1].Name, Top10[i-1].Score);
                             DrawText(LeaderboardText, 600, 50*i, 48, WHITE);
                         }