about summary refs log tree commit diff stats
path: root/src/main.c
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-06-01 20:21:10 -0400
committerCharadon <dev@iotib.net>2022-06-01 20:21:10 -0400
commit3f0c12dbea2cc070888f0db9102c12d0af6f2e90 (patch)
tree6857274c7a7df90c348e6763bd5fd4910bfdb809 /src/main.c
parent01a21af4c041c6f3133b4202ca35c156ffb00f32 (diff)
downloadPong-C-3f0c12dbea2cc070888f0db9102c12d0af6f2e90.tar.gz
Flatpak support
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 9339b92..de4dcb0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,6 +2,7 @@
 #include "sounds.h"
 #include <raylib.h>
 #include <setjmp.h>
+#include <threads.h>
 
 
 int Difficulty = 1;
@@ -103,7 +104,7 @@ int main() {
 	MainCamera.offset = (Vector2){0, 0};
 	MainCamera.rotation = 0;
 	//Populate Audio Queue
-	for(unsigned int i = 0; i < sizeof(AudioQueue); i++) {
+	for(unsigned int i = 0; i < 20; i++) {
 		AudioQueue[i] = -1;
 	}
 	mtx_init(&AudioQueueBeingModified, mtx_plain);
@@ -158,13 +159,34 @@ int main() {
 		MainCamera.offset = (Vector2){GetScreenWidth()/2.0f, GetScreenHeight()/2.0f};
 		MainCamera.target = (Vector2){1280/2.0f, 720/2.0f};
 
+
+		// Who won?
 		if (Enemy.Score >= 5) {
+			StopSoundMulti();
 			play_audio(MUSIC_DEFEAT);
+			while(!IsKeyDown(KEY_SPACE)) {
+				BeginDrawing();
+					EnableCursor();
+					ClearBackground(BLACK);
+					DrawText("You Lose.", 0, 0, 128, RED);
+					DrawText("Press space to return to title screen.", 0, 128, 24, WHITE);
+				EndDrawing();
+			}
 			longjmp(RestartGame, 0);
 		} else if (Player.Score >= 5) {
+			StopSoundMulti();
 			play_audio(MUSIC_VICTORY);
+			while(!IsKeyDown(KEY_SPACE)) {
+				BeginDrawing();
+					EnableCursor();
+					ClearBackground(BLACK);
+					DrawText("You Win!", 0, 0, 128, BLUE);
+					DrawText("Press space to return to title screen.", 0, 128, 24, WHITE);
+				EndDrawing();
+			}
 			longjmp(RestartGame, 0);
 		}
+
 		//Controls
 		if(IsKeyDown(KEY_UP)) {
 			Player.Y -= 10;
@@ -201,7 +223,6 @@ int main() {
 		//Turn Scores into strings.
 		snprintf(PlayerScore, 50, "Player: %d", Player.Score);
 		snprintf(EnemyScore, 50, "Enemy: %d", Enemy.Score);
-		printf("%f\n", Enemy.Y);
 		
 		BeginDrawing();
 			ClearBackground(BLACK);