diff options
Diffstat (limited to 'src/marathon.c')
-rw-r--r-- | src/marathon.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/marathon.c b/src/marathon.c index 9e05b7a..02c5b3f 100644 --- a/src/marathon.c +++ b/src/marathon.c @@ -1,12 +1,12 @@ #include "pong.h" #include "raylib.h" +#include <SDL2/SDL_mixer.h> void marathon_main() { // Init Music - Music Background = LoadMusicStream("resources/marathon.wav"); - Background.looping = true; - PlayMusicStream(Background); + Mix_Music *Background = Mix_LoadMUS("resources/marathon.wav"); + Mix_PlayMusic(Background, -1); // Init balls lmao struct Balls Ball; @@ -42,7 +42,7 @@ void marathon_main() { if (WindowShouldClose()) { //Quit Game if the window is closed. GameGoing = false; } - UpdateMusicStream(Background); + snprintf(PlayerScore, 50, "Player: %d", Player.Score); MainCamera.zoom = GetScreenHeight()/720.0f; MainCamera.offset = (Vector2){GetScreenWidth()/2.0f, GetScreenHeight()/2.0f}; @@ -62,7 +62,7 @@ void marathon_main() { // Leave game if(IsKeyPressed(KEY_Q)) { - return; + MarathonGoing = false; } if(GetMouseY() < 0) { @@ -93,6 +93,8 @@ void marathon_main() { EndMode2D(); EndDrawing(); } + Mix_HaltMusic(); + Mix_FreeMusic(Background); EnableCursor(); return; } |