about summary refs log tree commit diff stats
path: root/src/versus.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/versus.c')
-rw-r--r--src/versus.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/versus.c b/src/versus.c
index a5c1060..ed933e5 100644
--- a/src/versus.c
+++ b/src/versus.c
@@ -1,4 +1,5 @@
 #include "pong.h"
+#include "raylib.h"
 
 void versus_main() {
     // Init Player Variables
@@ -19,6 +20,11 @@ void versus_main() {
 	Ball.Direction = LEFT;
 	Ball.Speed = 3.0f;
 	Ball.Angle = 0.0f;
+
+	// Init music
+	Music Background = LoadMusicStream("resources/versus.wav");
+	Background.looping = true;
+	PlayMusicStream(Background);
     
     // Set Sprites
 	Texture2D PaddleSprite = LoadTexture("resources/paddle.png");
@@ -31,12 +37,13 @@ void versus_main() {
 	Enemy.BallDetector = (Rectangle){0, Enemy.Y+120, 1280, PaddleSprite.height/5.0f};
     char EnemyScore[50];
     char PlayerScore[50]; // Used later to display score on screen.
-        // Init Camera
+    // Init Camera
     Camera2D MainCamera;
         MainCamera.target = (Vector2){0, 0};
         MainCamera.offset = (Vector2){0, 0};
         MainCamera.rotation = 0;
     while(!WindowShouldClose() && GameGoing == true) {
+		UpdateMusicStream(Background);
 		MainCamera.zoom = GetScreenHeight()/720.0f;
 		MainCamera.offset = (Vector2){GetScreenWidth()/2.0f, GetScreenHeight()/2.0f};
 		MainCamera.target = (Vector2){1280/2.0f, 720/2.0f};