diff options
author | nathansmith117 <thenathansmithsmith@gmail.com> | 2024-02-21 03:37:40 +0000 |
---|---|---|
committer | nathansmith117 <thenathansmithsmith@gmail.com> | 2024-02-21 03:37:40 +0000 |
commit | 76aa6ea16db1bfee36f86f461ea8487c60296973 (patch) | |
tree | 19d7cb2cc58b73364d90120bd7f63973a716f38c | |
parent | 8ff25c1e8951304ff5c125e05a8fa044a198ef72 (diff) | |
download | PenguinYippies-76aa6ea16db1bfee36f86f461ea8487c60296973.tar.gz PenguinYippies-76aa6ea16db1bfee36f86f461ea8487c60296973.tar.bz2 PenguinYippies-76aa6ea16db1bfee36f86f461ea8487c60296973.zip |
Button panel
-rw-r--r-- | src/gameCommon.h | 4 | ||||
-rw-r--r-- | src/gameScreen.c | 55 | ||||
-rw-r--r-- | src/gameScreen.h | 12 |
3 files changed, 58 insertions, 13 deletions
diff --git a/src/gameCommon.h b/src/gameCommon.h index ceca8b8..1a9edea 100644 --- a/src/gameCommon.h +++ b/src/gameCommon.h @@ -6,8 +6,8 @@ #include <raylib.h> #include <raymath.h> -#define WINDOW_WIDTH 1280 -#define WINDOW_HEIGHT 720 +#define WINDOW_WIDTH 1366 +#define WINDOW_HEIGHT 768 #ifndef GAME_COMMON_H #define GAME_COMMON_H diff --git a/src/gameScreen.c b/src/gameScreen.c index 1af0faf..96c1ed6 100644 --- a/src/gameScreen.c +++ b/src/gameScreen.c @@ -1,8 +1,10 @@ #include "gameScreen.h" #include "game.h" +#include "assets.h" void initGameScreen(GameScreen* gameScreen, Game* game) { + Assets* assets = &game->assets; int width = GetScreenWidth(); int height = GetScreenHeight(); int navigationButtonSize = 100; @@ -10,7 +12,7 @@ void initGameScreen(GameScreen* gameScreen, Game* game) // Navigation buttons. gameScreen->toGameButton = createTexturedButton( - &game->assets.textures[TO_GAME_ICON_TEXTURE], + &assets->textures[TO_GAME_ICON_TEXTURE], (Rectangle){navigationButtonX, 5.0, navigationButtonSize, navigationButtonSize}, "", WHITE, @@ -18,12 +20,53 @@ void initGameScreen(GameScreen* gameScreen, Game* game) ); gameScreen->toEmperorsEmporiumButton = createTexturedButton( - &game->assets.textures[TO_EMPERORS_EMPORIUM_ICON_TEXTURE], + &assets->textures[TO_EMPERORS_EMPORIUM_ICON_TEXTURE], (Rectangle){navigationButtonX, navigationButtonSize + 15.0, navigationButtonSize, navigationButtonSize}, "", WHITE, BLACK ); + + // Button pannel thingy. + gameScreen->buttonPanelSharedAnimation = createAnimation(&assets->animations[BUTTON_BOX_ANIMATION], ANIMATION_DEFAULT_DELAY); + playAnimation(&gameScreen->buttonPanelSharedAnimation); + + Texture* buttonTexture = &gameScreen->buttonPanelSharedAnimation.texture; + int buttonWidth = width / 4; + int buttonHeight = 100; + int buttonY = height - buttonHeight; + + gameScreen->upgradesButton = createTexturedButton( + buttonTexture, + (Rectangle){0.0, buttonY, buttonWidth, buttonHeight}, + "Upgrades", + WHITE, + BLACK + ); + + gameScreen->achievementsButton = createTexturedButton( + buttonTexture, + (Rectangle){buttonWidth, buttonY, buttonWidth, buttonHeight}, + "Achievements", + WHITE, + BLACK + ); + + gameScreen->rebirthButton = createTexturedButton( + buttonTexture, + (Rectangle){buttonWidth * 2.0, buttonY, buttonWidth, buttonHeight}, + "Rebirth", + WHITE, + BLACK + ); + + gameScreen->statisticsButton = createTexturedButton( + buttonTexture, + (Rectangle){buttonWidth * 3.0, buttonY, buttonWidth, buttonHeight}, + "Statistics", + WHITE, + BLACK + ); } void updateGameScreen(GameScreen* gameScreen, Game* game) @@ -43,9 +86,17 @@ void updateGameScreen(GameScreen* gameScreen, Game* game) // Navigation buttons. updateTexturedButton(&gameScreen->toGameButton); updateTexturedButton(&gameScreen->toEmperorsEmporiumButton); + + // Button panel. + runAnimation(&gameScreen->buttonPanelSharedAnimation); + updateTexturedButton(&gameScreen->upgradesButton); + updateTexturedButton(&gameScreen->achievementsButton); + updateTexturedButton(&gameScreen->rebirthButton); + updateTexturedButton(&gameScreen->statisticsButton); } void closeGameScreen(GameScreen* gameScreen) { + closeAnimation(&gameScreen->buttonPanelSharedAnimation); } diff --git a/src/gameScreen.h b/src/gameScreen.h index f911edd..45be947 100644 --- a/src/gameScreen.h +++ b/src/gameScreen.h @@ -9,17 +9,11 @@ typedef struct GameScreen { TexturedButton toGameButton; TexturedButton toEmperorsEmporiumButton; - // The little button panel at the bottem. - Animation updateButtonAnimation; - TexturedButton updateButton; - - Animation achievementsButtonAnimation; + // The little button panel at the bottom. + Animation buttonPanelSharedAnimation; + TexturedButton upgradesButton; TexturedButton achievementsButton; - - Animation rebirthButtonAnimation; TexturedButton rebirthButton; - - Animation statisticsButtonAnimation; TexturedButton statisticsButton; } GameScreen; |