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.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/title.c b/src/title.c
index 3e85a96..2f8148d 100644
--- a/src/title.c
+++ b/src/title.c
@@ -13,8 +13,11 @@ int title_screen() {
     MainCamera.offset = (Vector2){0,0};
     MainCamera.target = (Vector2){0,0};
     MainCamera.rotation = 0.0f;
+
     bool TitleScreenGoing = true;
-    play_audio(MUSIC_TITLE);
+    int Choice = 0;
+
+    // Selection
     Rectangle Versus = {
         20, 150, 230, 48
     };
@@ -36,6 +39,12 @@ int title_screen() {
     Rectangle *Selected;
     Selected = &Versus;
     EnableCursor();
+
+    //Music
+    Mix_Music *TitleMusic = Mix_LoadMUS("resources/title.wav");
+    Mix_PlayMusic(TitleMusic, 1);
+    Mix_VolumeMusic(GlobalSettings.MusicVolume);
+
     while(TitleScreenGoing == true && GameGoing == true) {
         
         if (WindowShouldClose()) { //Quit Game if the window is closed.
@@ -49,12 +58,14 @@ int title_screen() {
         if (CheckCollisionRecs(Mouse, Versus)) {
             Selected = &Versus;
             if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
-                return(0); 
+                Choice = 0;
+                TitleScreenGoing = false;
             }
         } else if (CheckCollisionRecs(Mouse, Marathon)) {
             Selected = &Marathon;
             if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
-                return(1);
+                Choice = 1;
+                TitleScreenGoing = false;
             }
         } else if (CheckCollisionRecs(Mouse, Settings)) {
             Selected = &Settings;
@@ -81,5 +92,7 @@ int title_screen() {
             DrawText(VersionString, GetScreenWidth()-400, GetScreenHeight()-32, 32, GREEN);
         EndDrawing();
     }
-    return -1;
+    Mix_HaltMusic();
+    Mix_FreeMusic(TitleMusic);
+    return Choice;
 }
/pre>
107fdd35 ^


9b55f2de ^
a4cadf78 ^
107fdd35 ^
2260e3bd ^




107fdd35 ^
a2726b6a ^


107fdd35 ^
055a5f71 ^

a2726b6a ^






e816b124 ^
3b0f7e10 ^
107fdd35 ^
a2726b6a ^


6b830277 ^
a2726b6a ^



2e0bc27b ^

973a05d1 ^
b210fb36 ^
107fdd35 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79