about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-06-11 23:31:37 -0400
committerCharadon <dev@iotib.net>2022-06-11 23:31:37 -0400
commit05b4d914d92738a1ade55f24ac900c07f5a9c336 (patch)
tree5d958b86a3ffbbe899a23081b82f8a2cde6b703d
parent05c6ad238e4be9dc10ab832c2f0217931cef9c63 (diff)
downloadPong-C-05b4d914d92738a1ade55f24ac900c07f5a9c336.tar.gz
Fixed issue where you get booted out the settings menu depending on where your mouse is
-rw-r--r--src/title.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/title.c b/src/title.c
index 1dd0c87..b2ce12b 100644
--- a/src/title.c
+++ b/src/title.c
@@ -100,14 +100,6 @@ static void settings(Camera2D *MainCamera, Mix_Music *TitleScreenMusic) {
     int MusicBarY = 50;
     int SoundBarY = 150;
 
-    // Mouse
-    Rectangle MouseCursor = {
-        0,0,1,1
-    };
-    Vector2 OldPosition = GetMousePosition();
-    Vector2 NewPosition = GetMousePosition();
-    Texture2D MouseCursorSprite = LoadTexture("resources/cursor.png");
-
     Rectangle MusicBar[10] = {
         {50,MusicBarY,50,50},
         {105,MusicBarY,50,50},
@@ -147,6 +139,13 @@ static void settings(Camera2D *MainCamera, Mix_Music *TitleScreenMusic) {
         {95, 326, ScreenButtonLength, 42}
     };
     SetMousePosition(GetScreenWidth()/2, GetScreenHeight()/2);
+    // Mouse
+    Rectangle MouseCursor = {
+        1280/2.0f,720/2.0f,1,1
+    };
+    Vector2 OldPosition = GetMousePosition();
+    Vector2 NewPosition = GetMousePosition();
+    Texture2D MouseCursorSprite = LoadTexture("resources/cursor.png");
     bool MouseCursorIn = true;
     while(SettingsGoing == true && GameGoing == true) {
         MainCamera->zoom = GetScreenHeight()/720.0f;
@@ -215,6 +214,7 @@ static void settings(Camera2D *MainCamera, Mix_Music *TitleScreenMusic) {
                 }
             }
             // Fullscreen
+            DrawRectangle(95, 243, 250, 125, DARKGRAY);
             bool MouseHovering = false;
             for(int i = 0; i < 3; i++) {
                 if(CheckCollisionRecs(MouseCursor, ScreenButtons[i])) {
@@ -233,7 +233,7 @@ static void settings(Camera2D *MainCamera, Mix_Music *TitleScreenMusic) {
             DrawText("Windowed", 100, 242, 42, WHITE);
             DrawText("Fullscreen", 100, 284, 42, WHITE);
             DrawText("Borderless", 100, 326, 42, WHITE);
-	    DrawTexture(MouseCursorSprite, MouseCursor.x, MouseCursor.y, WHITE);
+	        DrawTexture(MouseCursorSprite, MouseCursor.x, MouseCursor.y, WHITE);
         EndMode2D();
         EndDrawing();
     }