diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2025-01-05 14:26:19 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2025-01-05 14:26:19 +0100 |
commit | ba170d00586ab261e015cc2febbb43f9aa7ae43e (patch) | |
tree | 4b902f20aa0b10a3ac04ec2c03f46ec3449558d1 /game/mainmenu | |
parent | 5ae4e3f0e3ff1d111eaea54b7b0a0788203d9d72 (diff) |
added hud
Diffstat (limited to 'game/mainmenu')
-rw-r--r-- | game/mainmenu/BannerSubScene.cpp | 5 | ||||
-rw-r--r-- | game/mainmenu/ButtonSubScene.cpp | 5 | ||||
-rw-r--r-- | game/mainmenu/MainMenuConfig.h | 5 | ||||
-rw-r--r-- | game/mainmenu/MainMenuScene.cpp | 3 |
4 files changed, 9 insertions, 9 deletions
diff --git a/game/mainmenu/BannerSubScene.cpp b/game/mainmenu/BannerSubScene.cpp index ba4c126..0659d96 100644 --- a/game/mainmenu/BannerSubScene.cpp +++ b/game/mainmenu/BannerSubScene.cpp @@ -1,5 +1,6 @@ #include "BannerSubScene.h" #include "MainMenuConfig.h" +#include "../Config.h" #include <crepe/api/Sprite.h> @@ -33,9 +34,9 @@ void BannerSubScene::create(Scene & scn,const Data & data){ }); crepe::vec2 size = {data.banner_title_width,(data.banner_title_width/data.banner_title.size())*2}; - menu_banner.add_component<Text>( size, MainMenuConfig::FONT, Text::Data{ + menu_banner.add_component<Text>( size, FONT, Text::Data{ .world_space = true, .text_color = Color::WHITE, - }, data.banner_title_offset + MainMenuConfig::FONTOFFSET, data.banner_title); + }, data.banner_title_offset + FONTOFFSET, data.banner_title); } diff --git a/game/mainmenu/ButtonSubScene.cpp b/game/mainmenu/ButtonSubScene.cpp index 53ac8d0..760fc0d 100644 --- a/game/mainmenu/ButtonSubScene.cpp +++ b/game/mainmenu/ButtonSubScene.cpp @@ -4,6 +4,7 @@ #include "ButtonTransitionPreviewScript.h" #include "IButtonScript.h" #include "MainMenuConfig.h" +#include "../Config.h" #include "api/Color.h" #include <crepe/api/BehaviorScript.h> @@ -26,10 +27,10 @@ void ButtonSubScene::create(Scene & scn,const Data & data){ void ButtonSubScene::btn_text(crepe::GameObject & button_object,const Data & data){ crepe::vec2 size = {data.text_width,(data.text_width/data.text.size())*2}; - button_object.add_component<Text>(size, MainMenuConfig::FONT,Text::Data{ + button_object.add_component<Text>(size, FONT,Text::Data{ .world_space = data.worldspace, .text_color = Color::WHITE, - }, data.text_offset+MainMenuConfig::FONTOFFSET, data.text); + }, data.text_offset+FONTOFFSET, data.text); } void ButtonSubScene::set_script(crepe::GameObject & button_object,const Data & data){ diff --git a/game/mainmenu/MainMenuConfig.h b/game/mainmenu/MainMenuConfig.h index 99d29e8..0ce5980 100644 --- a/game/mainmenu/MainMenuConfig.h +++ b/game/mainmenu/MainMenuConfig.h @@ -29,14 +29,11 @@ struct MainMenuConfig { static constexpr float VELOCITY_STEP = 200; static constexpr float VELOCITY_INFO_UP = 30; //button config - static constexpr const char* FONT = "Jetpackia"; - static constexpr crepe::vec2 FONTOFFSET = {0,0}; static constexpr crepe::vec2 LARGE_OVERLAY_SIZE = {250,100}; static constexpr crepe::vec2 SMALL_OVERLAY_SIZE_RIGHT = {150,100}; static constexpr crepe::vec2 SMALL_OVERLAY_SIZE_LEFT = {50,100}; static constexpr crepe::vec2 SIDE_PANEL_SIZE = {50,150}; static constexpr crepe::vec2 ICON_SIZE = {50,50}; - //total coins (move to main config) - static constexpr const char* TOTAL_COINS = "total_coins"; + }; diff --git a/game/mainmenu/MainMenuScene.cpp b/game/mainmenu/MainMenuScene.cpp index e68696b..c2306b1 100644 --- a/game/mainmenu/MainMenuScene.cpp +++ b/game/mainmenu/MainMenuScene.cpp @@ -9,6 +9,7 @@ #include "api/GameObject.h" #include "api/Sprite.h" #include "manager/SaveManager.h" +#include "../Config.h" using namespace crepe; using namespace std; @@ -71,7 +72,7 @@ void MainMenuScene::load_scene(){ .world_space = false, }); SaveManager & savemgr = this->get_save_manager(); - std::string number = std::to_string(savemgr.get<int>(MainMenuConfig::TOTAL_COINS,123).get()); + string number = std::to_string(savemgr.get<int>(TOTAL_COINS_GAME,0).get()); float amount_number = static_cast<float>(number.size()); // savemgr.set(COIN_GAME_AMOUNT, amount); button.create(*this,ButtonSubScene::Data{ |