diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-12-20 17:07:17 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-12-20 17:07:17 +0100 |
commit | 5a2f6a14803885b7c53bab7d43208476d2e1bd5b (patch) | |
tree | 4ae6e6e3e12babb9a8f1c2ed6e5a880e518e21b7 /game/mainmenu/ButtonSubScene.cpp | |
parent | 667ed9ac9b1e51ef87a5a0bca25566f39f087671 (diff) |
added text to btn
Diffstat (limited to 'game/mainmenu/ButtonSubScene.cpp')
-rw-r--r-- | game/mainmenu/ButtonSubScene.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/game/mainmenu/ButtonSubScene.cpp b/game/mainmenu/ButtonSubScene.cpp index 168b387..ac51c1b 100644 --- a/game/mainmenu/ButtonSubScene.cpp +++ b/game/mainmenu/ButtonSubScene.cpp @@ -1,20 +1,42 @@ #include "ButtonSubScene.h" #include "ButtonScript.h" +#include "system/RenderSystem.h" + #include <crepe/api/BehaviorScript.h> #include <crepe/api/Sprite.h> #include <crepe/api/Scene.h> #include <crepe/api/Button.h> +#include <crepe/api/Text.h> using namespace crepe; using namespace std; void ButtonSubScene::create(Scene & scn){ GameObject button_object = scn.new_object("button"); - button_object.add_component<Button>(vec2{100,100},vec2{0,0}); - button_object.add_component<Sprite>(Asset("asset/coin/coin_64.png"),Sprite::Data{ - .size = vec2{100,100}, - }); + button_object.add_component<Button>(vec2{250,100},vec2{0,0}); button_object.add_component<BehaviorScript>().set_script<ButtonScript>(); + this->large_btn_overlay(button_object); } +void ButtonSubScene::large_btn_overlay(crepe::GameObject & button_object){ + button_object.add_component<Sprite>(Asset("asset/ui/buttonBacking.png"),Sprite::Data{ + .sorting_in_layer = 0, + .size = vec2{250,100}, + }); + button_object.add_component<Sprite>(Asset("asset/ui/buttonSmallBlue.png"),Sprite::Data{ + .sorting_in_layer = 1, + .size = vec2{50,150}, + .position_offset = {110,0}, + }); + button_object.add_component<Sprite>(Asset("asset/ui/buttonSmallBlue.png"),Sprite::Data{ + .flip = {true,false}, + .sorting_in_layer = 1, + .size = vec2{75,150}, + .position_offset = {-110,0}, + }); + //fc-match arial + button_object.add_component<Text>(vec2{220,100},vec2{0,0}, "dejavusans", Text::Data{ + .text_color = Color::MAGENTA, + }, "Hallo"); +} |