about summary refs log tree commit diff stats
path: root/src/title.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/title.c')
-rw-r--r--src/title.c58
1 files changed, 54 insertions, 4 deletions
diff --git a/src/title.c b/src/title.c
index 2f8148d..6066797 100644
--- a/src/title.c
+++ b/src/title.c
@@ -1,9 +1,56 @@
 #include "pong.h"
-#include "raylib.h"
 
+static void settings(Camera2D *MainCamera, Mix_Music *TitleScreenMusic) {
+    bool SettingsGoing = true;
+    int MusicBarY = 50;
 
+    Rectangle MouseCursor = {
+        0,0,1,1
+    };
 
-void help_text() {
+    Rectangle MusicBar[10] = {
+        {50,MusicBarY,50,50},
+        {105,MusicBarY,50,50},
+        {160,MusicBarY,50,50},
+        {215,MusicBarY,50,50},
+        {270,MusicBarY,50,50},
+        {325,MusicBarY,50,50},
+        {380,MusicBarY,50,50},
+        {435,MusicBarY,50,50},
+        {490,MusicBarY,50,50},
+        {545,MusicBarY,50,50},
+    };
+    while(SettingsGoing == true && GameGoing == true) {
+        MouseCursor.x = GetMouseX();
+        MouseCursor.y = GetMouseY();
+        Mix_VolumeMusic(GlobalSettings.MusicVolume);
+        BeginDrawing();
+        ClearBackground(BLACK);
+        BeginMode2D(*MainCamera);
+
+            // Music
+            DrawText("Music Volume:", 50, 10, 42, WHITE);
+            DrawText("<", 0,0,128,WHITE);
+            for(int i = 0; i < 10; i++) {
+                if (CheckCollisionRecs(MouseCursor, MusicBar[i]) && IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
+                    GlobalSettings.MusicVolume = i*10;
+                }
+                if(i <= (GlobalSettings.MusicVolume/10)) {
+                    DrawRectangleRec(MusicBar[i], RED);
+                }
+            }
+
+            // Sound
+
+            // Fullscreen
+        EndMode2D();
+        EndDrawing();
+    }
+    // Put save to file here.
+    return;
+}
+
+static void help_text() {
 
 }
 
@@ -42,7 +89,7 @@ int title_screen() {
 
     //Music
     Mix_Music *TitleMusic = Mix_LoadMUS("resources/title.wav");
-    Mix_PlayMusic(TitleMusic, 1);
+    Mix_PlayMusic(TitleMusic, -1);
     Mix_VolumeMusic(GlobalSettings.MusicVolume);
 
     while(TitleScreenGoing == true && GameGoing == true) {
@@ -69,13 +116,16 @@ int title_screen() {
             }
         } else if (CheckCollisionRecs(Mouse, Settings)) {
             Selected = &Settings;
+            if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
+                settings(&MainCamera, TitleMusic);
+            }
         } else if (CheckCollisionRecs(Mouse, Help)) {
             Selected = &Help;
         } else if (CheckCollisionRecs(Mouse, Exit)) {
             Selected = &Exit;
             if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
                 GameGoing = false;
-                return -1;
+                Choice = -1;
             }
         }
         BeginDrawing();