about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/pause.c54
-rw-r--r--src/versus.c11
2 files changed, 27 insertions, 38 deletions
diff --git a/src/pause.c b/src/pause.c
index 11c2e9d..c3264ec 100644
--- a/src/pause.c
+++ b/src/pause.c
@@ -16,22 +16,22 @@ bool pause_screen(Camera2D *MainCamera) {
 	int Choice = 0;
 	while(PauseScreenGoing == true && GameGoing == true) {
 		/* Update Camera */
-        	MainCamera->zoom = GetScreenHeight()/720.0f;
-			MainCamera->offset = (Vector2){GetScreenWidth()/2.0f, GetScreenHeight()/2.0f};
-			MainCamera->target = (Vector2){1280/2.0f, 720/2.0f};
+        MainCamera->zoom = GetScreenHeight()/720.0f;
+		MainCamera->offset = (Vector2){GetScreenWidth()/2.0f, GetScreenHeight()/2.0f};
+		MainCamera->target = (Vector2){1280/2.0f, 720/2.0f};
 		/* Mouse */
-        	if (MouseCursorIn == true) {
-            		OldPosition = NewPosition;
-            		NewPosition = GetMousePosition();
-            		Mouse.y -= OldPosition.y-NewPosition.y;
-            		Mouse.x -= OldPosition.x-NewPosition.x;
-            		if (Mouse.y >= 720 || Mouse.y <= 0) {
-                		Mouse.y += OldPosition.y-NewPosition.y;
-            		}
-            		if (Mouse.x >= 1280 || Mouse.x <= 0) {
-                		Mouse.x += OldPosition.x-NewPosition.x;
-            		}
-        	}
+        if (MouseCursorIn == true) {
+           		OldPosition = NewPosition;
+           		NewPosition = GetMousePosition();
+           		Mouse.y -= OldPosition.y-NewPosition.y;
+           		Mouse.x -= OldPosition.x-NewPosition.x;
+           		if (Mouse.y >= 720 || Mouse.y <= 0) {
+               		Mouse.y += OldPosition.y-NewPosition.y;
+           		}
+           		if (Mouse.x >= 1280 || Mouse.x <= 0) {
+               		Mouse.x += OldPosition.x-NewPosition.x;
+           		}
+        }
 
 		if(IsKeyPressed(KEY_Y)) {
 			return false;
@@ -40,15 +40,15 @@ bool pause_screen(Camera2D *MainCamera) {
 		}
         
 		if (IsKeyPressed(KEY_ESCAPE)) {
-            		EnableCursor();
-            		MouseCursorIn = false;
-        	} else if (IsCursorOnScreen() && IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
-            		DisableCursor();
-            		MouseCursorIn = true;
-        	}
-		if (IsKeyPressed(KEY_A)) {
+			EnableCursor();
+			MouseCursorIn = false;
+       	} else if (IsCursorOnScreen() && IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
+			DisableCursor();
+           	MouseCursorIn = true;
+       	}
+		if (player_controls() == CONTROLLER_LEFT) {
 			Choice--;
-		} else if (IsKeyPressed(KEY_D)) {
+		} else if (player_controls() == CONTROLLER_RIGHT) {
 			Choice++;
 		}
 
@@ -64,14 +64,8 @@ bool pause_screen(Camera2D *MainCamera) {
 				DrawRectangle(0, 0, 1280, 720, (Color){20,20,20,255});
 				if(CheckCollisionRecs(Mouse, (Rectangle){1280/3.0f, (720/3.0f)+50, 100, 50})) {
 					Choice = 0;
-					if(IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
-						return false;
-					}
 				} else if(CheckCollisionRecs(Mouse, (Rectangle){(1280/3.0f)+150, (720/3.0f)+50, 70, 50})) {
 					Choice = 1;
-					if(IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
-						return true;
-					}
 				}
 				switch(Choice) {
 					case 0:
@@ -81,7 +75,7 @@ bool pause_screen(Camera2D *MainCamera) {
 						DrawRectangle((1280/3.0f)+150,(720/3.0f)+50, 70, 50, RED);
 						break;
 				}
-				if (IsKeyPressed(KEY_SPACE)) {
+				if ( player_controls() == CONTROLLER_ACTIVATE ) {
 					switch(Choice) {
 						case 0:
 							return false;
diff --git a/src/versus.c b/src/versus.c
index d808b80..bf6027e 100644
--- a/src/versus.c
+++ b/src/versus.c
@@ -98,11 +98,11 @@ void versus_main() {
 			MouseMoved = true;
 		}
 		MouseLastPosition = MouseCurrentPosition;
-		if(IsKeyDown(KEY_W) || IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_UP)) {
+		if( player_controls() == CONTROLLER_UP ){
 			Player.Y -= 20;
-		} else if (IsKeyDown(KEY_S) || IsGamepadButtonDown(0, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) {
+		} else if ( player_controls() == CONTROLLER_DOWN ){
 			Player.Y += 20;
-		} else if (IsKeyPressed(KEY_ESCAPE)) {
+		} else if ( player_controls() == CONTROLLER_PAUSE ){
 				Mix_PauseMusic();
 				BeginDrawing();
 				EndDrawing();
@@ -115,11 +115,6 @@ void versus_main() {
 			DisableCursor();
 		}
 		
-		/* Leave Game */
-		if(IsKeyPressed(KEY_Q)) {
-			VersusGoing = false;
-		}
-		
 		if(GetMouseY() < 0) {
 			SetMousePosition(0, 0);
 		} else if(GetMouseY() > 720) {