From 0be4fca7d5d05fe3cb161ed92218277f4af739e0 Mon Sep 17 00:00:00 2001
From: nathansmithsmith <thenathansmithsmith@gmail.com>
Date: Fri, 22 Dec 2023 12:37:18 -0700
Subject: Some info screen stuff

---
 src/screens/mainMenu.c | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

(limited to 'src/screens/mainMenu.c')

diff --git a/src/screens/mainMenu.c b/src/screens/mainMenu.c
index 8cc2b09..76e7cb4 100644
--- a/src/screens/mainMenu.c
+++ b/src/screens/mainMenu.c
@@ -6,6 +6,7 @@ void initMainMenu(Game * game) {
 	game->mainMenu = (MainMenu){
 		.startButton = (Rectangle){0.0, 0.0, 100.0, 50.0},
 		.howToPlayButton = (Rectangle){0.0, 0.0, 100.0, 50.0},
+		.infoButton = (Rectangle){0.0, 0.0, 100.0, 50.0},
 		.logoTexture = &game->assets.textures[ICON128_ASSET]
 	};
 
@@ -23,32 +24,36 @@ void updateMainMenu(Game * game) {
 		WHITE
 	);
 
-	// Start button.
-	bool start = GuiButton(mainMenu->startButton, "Start");
-
-	if (start)
+	if (GuiButton(mainMenu->startButton, "Start"))
 		openGameScreen(game);
 
-	// How to play button.
-	bool clickedHowToPlay = GuiButton(mainMenu->howToPlayButton, "How to play");
-
-	if (clickedHowToPlay)
+	if (GuiButton(mainMenu->howToPlayButton, "How to play"))
 		game->screenId= HOW_TO_PLAY_SCREEN;
+
+	if (GuiButton(mainMenu->infoButton, "Info"))
+		game->screenId = INFO_SCREEN;
 }
 
 void resizeMainMenu(Game * game, MainMenu * mainMenu) {
+	int width = GetScreenWidth();
+	int height = GetScreenHeight();
+
 	// Logo.
 	mainMenu->logoPosition = (Vector2){
-		(GetScreenWidth() / 2.0) - (mainMenu->logoTexture->width / 2.0),
-		(GetScreenHeight() / 2.0) - (mainMenu->logoTexture->height * 1.50)
+		(width / 2.0) - (mainMenu->logoTexture->width / 2.0),
+		(height / 2.0) - (mainMenu->logoTexture->height * 1.50)
 	};
 
 	// Start button.
-	mainMenu->startButton.x = (GetScreenWidth() / 2.0) - (mainMenu->startButton.width / 2.0);
-	mainMenu->startButton.y = (GetScreenHeight() / 2.0) - (mainMenu->startButton.height / 2.0);
+	mainMenu->startButton.x = (width / 2.0) - (mainMenu->startButton.width / 2.0);
+	mainMenu->startButton.y = (height / 2.0) - (mainMenu->startButton.height / 2.0);
 
 	// How to play button.
-	mainMenu->howToPlayButton.x = (GetScreenWidth() / 2.0) - (mainMenu->startButton.width / 2.0);
-	mainMenu->howToPlayButton.y = (GetScreenHeight() / 2.0) - (mainMenu->startButton.height / 2.0);
+	mainMenu->howToPlayButton.x = (width / 2.0) - (mainMenu->startButton.width / 2.0);
+	mainMenu->howToPlayButton.y = (height / 2.0) - (mainMenu->startButton.height / 2.0);
 	mainMenu->howToPlayButton.y += mainMenu->startButton.height;
+
+	// Info button.
+	mainMenu->infoButton.x = (width / 2.0) - (mainMenu->infoButton.width / 2.0);
+	mainMenu->infoButton.y = mainMenu->howToPlayButton.height + mainMenu->howToPlayButton.y;
 }
-- 
cgit v1.2.3