about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c3
-rw-r--r--src/title.c38
2 files changed, 27 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c
index 8eaba43..4a383f4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -46,6 +46,7 @@ void set_screen_mode() {
 	}
 	return;
 }
+
 double Started;
 static int internal_clock() {
 	static const double Framerate = 1.0/60.0f;
@@ -164,7 +165,7 @@ int main(int argc, char *argv[]) {
 	GlobalSettings.MusicVolume = 0;
 
 	//Init Variables
-	strncpy(VersionString, "Version 0.3 - Charon", sizeof(VersionString));
+	strncpy(VersionString, "Version 0.4 - APOLLO", sizeof(VersionString));
 	
 	//Populate Audio Queue
 	for(unsigned int i = 0; i < 20; i++) {
diff --git a/src/title.c b/src/title.c
index 9fe11cf..713b2c0 100644
--- a/src/title.c
+++ b/src/title.c
@@ -1,6 +1,5 @@
 #include "pong.h"
 #include <raylib.h>
-#include <stdio.h>
 
 struct LeaderboardEntries {
     int Score;
@@ -422,6 +421,18 @@ int title_screen() {
                 Mouse.x += OldPosition.x-NewPosition.x;
             }
         }
+
+		//Gamepad & Keyboard
+		if(IsGamepadButtonPressed(0, GAMEPAD_BUTTON_LEFT_FACE_DOWN) || IsKeyPressed(KEY_S)) {
+			Choice++;
+		} else if(IsGamepadButtonPressed(0, GAMEPAD_BUTTON_LEFT_FACE_UP) || IsKeyPressed(KEY_W)) {
+			Choice--;
+		}
+		if(Choice > 5) {
+			Choice = 5;
+		} else if(Choice < 0) {
+			Choice = 0;
+		}
         
         if (IsKeyPressed(KEY_ESCAPE)) {
             EnableCursor();
@@ -431,31 +442,32 @@ int title_screen() {
             MouseCursorIn = true;
         }
 
-        if (CheckCollisionRecs(Mouse, Versus)) {
+        if (CheckCollisionRecs(Mouse, Versus) || Choice == 0) {
             Selected = &Versus;
-            Choice = 0;
-            if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
+            if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) || IsKeyPressed(KEY_SPACE) || IsGamepadButtonPressed(0, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) {
                 TitleScreenGoing = false;
+            	Choice = 0;
             }
-        } else if (CheckCollisionRecs(Mouse, Marathon)) {
+        } else if (CheckCollisionRecs(Mouse, Marathon) || Choice == 1) {
             Selected = &Marathon;
-            Choice = 1;
-            if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
+            if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) || IsKeyPressed(KEY_SPACE) || IsGamepadButtonPressed(0, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) {
                 TitleScreenGoing = false;
+            	Choice = 1;
             }
-        } else if (CheckCollisionRecs(Mouse, Settings)) {
+        } else if (CheckCollisionRecs(Mouse, Settings) || Choice == 2) {
             Selected = &Settings;
-        Choice = 0;
-            if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
+            if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) || IsKeyPressed(KEY_SPACE) || IsGamepadButtonPressed(0, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) {
                 settings(&MainCamera, TitleMusic);
+        		Choice = 2;
             }
-        } else if (CheckCollisionRecs(Mouse, Help)) {
+        } else if (CheckCollisionRecs(Mouse, Help) || Choice == 3) {
             Selected = &Help;
-        } else if (CheckCollisionRecs(Mouse, Exit)) {
+			Choice = 3;
+        } else if (CheckCollisionRecs(Mouse, Exit) || Choice == -1) {
             Selected = &Exit;
+			Choice = 4;
             if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
                 GameGoing = false;
-                Choice = -1;
             }
         }
         BeginDrawing();