aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornathan <nathansmith@disroot.org>2026-01-30 13:48:30 +0000
committernathan <nathansmith@disroot.org>2026-01-30 13:48:30 +0000
commit056e88894cb81f805c0f0f7dc6ba30742df4d985 (patch)
tree8d1ad8834b4998641cb840b69defa99f99df1ce9
parent867d2cad25e6253df231fdd375b7fc1360d597ea (diff)
downloadFindThings-056e88894cb81f805c0f0f7dc6ba30742df4d985.tar.gz
FindThings-056e88894cb81f805c0f0f7dc6ba30742df4d985.tar.bz2
FindThings-056e88894cb81f805c0f0f7dc6ba30742df4d985.zip
Basic main menu
-rw-r--r--src/game.c56
1 files changed, 54 insertions, 2 deletions
diff --git a/src/game.c b/src/game.c
index 2568732..2969014 100644
--- a/src/game.c
+++ b/src/game.c
@@ -47,7 +47,7 @@ void resetScreenScale(Game* game)
void initGame(Game* game)
{
- game->sceneId = GAME_SCENE;
+ game->sceneId = MAIN_MENU_SCENE;
// Settings.
game->settings = defaultSettings();
@@ -100,12 +100,64 @@ void initGame(Game* game)
// Inventory.
initInventory(&game->inventory, &game->settings);
- disableGameCursor(game);
+ // disableGameCursor(game);
}
void updateMainMenuScene(Game* game)
{
ClearBackground(PINK);
+ float renderWidth = GetRenderWidth();
+ float renderHeight = GetRenderHeight();
+
+ float buttonWidth = 150.0;
+ float buttonHeight = 50.0;
+
+ // Draw logo.
+ float currentTime = GetTime();
+ Texture logoTexture = game->assets.textures[LOGO_TEXTURE];
+ float logoScale = 2.0 + ((int)currentTime % 2) * 0.1;
+
+ float logoHeight = logoTexture.height * logoScale;
+
+ Vector2 position = (Vector2){
+ renderWidth / 2.0 - logoTexture.width * logoScale / 2.0,
+ renderHeight / 2.0 - logoHeight / 2.0
+ };
+
+ position.y -= logoHeight;
+
+ DrawTextureEx(logoTexture,
+ position,
+ Wrap(currentTime * 0.5, -0.5, 0.5),
+ logoScale,
+ WHITE);
+
+ // Start button.
+ position.x = renderWidth / 2.0 - buttonWidth / 2.0;
+ position.y = renderHeight / 2.0;
+
+ if (GuiButton(
+ (Rectangle){position.x,
+ position.y,
+ buttonWidth,
+ buttonHeight},
+ "Start"))
+ {
+ game->sceneId = GAME_SCENE;
+ disableGameCursor(game);
+ }
+
+ position.y += buttonHeight + 1.0;
+
+ if (GuiButton(
+ (Rectangle){position.x,
+ position.y,
+ buttonWidth,
+ buttonHeight},
+ "Exit"))
+ {
+ CloseWindow();
+ }
}
void drawGameTexturedBackground(Texture texture)