diff options
author | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-12-22 02:06:49 -0700 |
---|---|---|
committer | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-12-22 02:06:49 -0700 |
commit | 18c26edd6bae8ce5bd26e0ab632086725f492871 (patch) | |
tree | 9835eaaf1c06be3f313ca92aa3f1dcb8577b56ad /src/mainMenu.c | |
parent | 35ccb272571efd684f050e579092ccb290a39c89 (diff) |
Moved the screens to a better place
Diffstat (limited to 'src/mainMenu.c')
-rw-r--r-- | src/mainMenu.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/mainMenu.c b/src/mainMenu.c deleted file mode 100644 index 8cc2b09..0000000 --- a/src/mainMenu.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "mainMenu.h" -#include "game.h" -#include "gameScreen.h" - -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}, - .logoTexture = &game->assets.textures[ICON128_ASSET] - }; - - resizeMainMenu(game, &game->mainMenu); -} - -void updateMainMenu(Game * game) { - MainMenu * mainMenu = &game->mainMenu; - ClearBackground(RAYWHITE); - - // Logo. - DrawTextureV( - *mainMenu->logoTexture, - mainMenu->logoPosition, - WHITE - ); - - // Start button. - bool start = GuiButton(mainMenu->startButton, "Start"); - - if (start) - openGameScreen(game); - - // How to play button. - bool clickedHowToPlay = GuiButton(mainMenu->howToPlayButton, "How to play"); - - if (clickedHowToPlay) - game->screenId= HOW_TO_PLAY_SCREEN; -} - -void resizeMainMenu(Game * game, MainMenu * mainMenu) { - // Logo. - mainMenu->logoPosition = (Vector2){ - (GetScreenWidth() / 2.0) - (mainMenu->logoTexture->width / 2.0), - (GetScreenHeight() / 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); - - // 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.y += mainMenu->startButton.height; -} |