From 056e88894cb81f805c0f0f7dc6ba30742df4d985 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 30 Jan 2026 06:48:30 -0700 Subject: Basic main menu --- src/game.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file 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) -- cgit v1.2.3