diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2025-01-03 16:12:14 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2025-01-03 16:12:14 +0100 |
commit | f18635b6c73f753bd38343684134430a5ce9b22c (patch) | |
tree | e838c01914244c517b17d6359241a8cbf78ac6ae /game/mainmenu | |
parent | b82c302e2eb5044ae966230a50aae9bdb698cf8c (diff) |
added coins random and menu banner update
Diffstat (limited to 'game/mainmenu')
-rw-r--r-- | game/mainmenu/BannerSubScene.cpp | 6 | ||||
-rw-r--r-- | game/mainmenu/BannerSubScene.h | 9 | ||||
-rw-r--r-- | game/mainmenu/ShopMenuScene.cpp | 6 |
3 files changed, 18 insertions, 3 deletions
diff --git a/game/mainmenu/BannerSubScene.cpp b/game/mainmenu/BannerSubScene.cpp index 0f4f075..8de5711 100644 --- a/game/mainmenu/BannerSubScene.cpp +++ b/game/mainmenu/BannerSubScene.cpp @@ -9,7 +9,7 @@ using namespace crepe; using namespace std; -void BannerSubScene::create(Scene & scn){ +void BannerSubScene::create(Scene & scn,const Data & data){ GameObject menu_banner = scn.new_object("menu_banner","", {0,-414}); menu_banner.add_component<Sprite>( Asset("asset/ui/settings_container/top_middle_setting.png"), @@ -31,5 +31,9 @@ void BannerSubScene::create(Scene & scn){ .size = {1100,7}, .position_offset {0,113}, }); + crepe::vec2 size = {data.banner_title_width,(data.banner_title_width/data.banner_title.size())*2}; + menu_banner.add_component<Text>(size,data.banner_title_offset + MainMenuConfig::FONTOFFSET, MainMenuConfig::FONT, Text::Data{ + .text_color = Color::WHITE, + }, data.banner_title); } diff --git a/game/mainmenu/BannerSubScene.h b/game/mainmenu/BannerSubScene.h index 06cd1a4..341943d 100644 --- a/game/mainmenu/BannerSubScene.h +++ b/game/mainmenu/BannerSubScene.h @@ -1,5 +1,6 @@ #pragma once +#include "types.h" #include <crepe/api/GameObject.h> namespace crepe { @@ -8,5 +9,11 @@ class Scene; class BannerSubScene { public: - void create(crepe::Scene & scn); +struct Data{ + const std::string & banner_title = "NODATA"; + const float banner_title_width = 100; + const crepe::vec2 & banner_title_offset = {0,0}; + }; +public: + void create(crepe::Scene & scn,const Data & data); }; diff --git a/game/mainmenu/ShopMenuScene.cpp b/game/mainmenu/ShopMenuScene.cpp index be2039f..d6ad870 100644 --- a/game/mainmenu/ShopMenuScene.cpp +++ b/game/mainmenu/ShopMenuScene.cpp @@ -16,7 +16,11 @@ void ShopMenuScene::load_scene(){ .bg_color = Color::RED, }); BannerSubScene banner; - banner.create(*this); + banner.create(*this,{ + .banner_title = "SHOP", + .banner_title_width = 200, + .banner_title_offset = {0,65}, + }); GameObject menu_background = this->new_object("menu_background"); menu_background.add_component<Sprite>( Asset("asset/ui/background.png"), |