diff options
-rw-r--r-- | game/mainmenu/ButtonSubScene.cpp | 30 | ||||
-rw-r--r-- | game/mainmenu/ButtonSubScene.h | 4 | ||||
-rw-r--r-- | game/mainmenu/MainMenuScene.cpp | 5 | ||||
-rw-r--r-- | src/crepe/api/Config.h | 2 |
4 files changed, 35 insertions, 6 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"); +} diff --git a/game/mainmenu/ButtonSubScene.h b/game/mainmenu/ButtonSubScene.h index 20e6bbc..fab076d 100644 --- a/game/mainmenu/ButtonSubScene.h +++ b/game/mainmenu/ButtonSubScene.h @@ -1,5 +1,7 @@ #pragma once +#include <crepe/api/GameObject.h> + namespace crepe { class Scene; } @@ -7,4 +9,6 @@ class Scene; class ButtonSubScene { public: void create(crepe::Scene & scn); +private: + void large_btn_overlay(crepe::GameObject & button_object); }; diff --git a/game/mainmenu/MainMenuScene.cpp b/game/mainmenu/MainMenuScene.cpp index 013eb2b..bc8ea86 100644 --- a/game/mainmenu/MainMenuScene.cpp +++ b/game/mainmenu/MainMenuScene.cpp @@ -8,7 +8,10 @@ using namespace std; void MainMenuScene::load_scene(){ GameObject camera_object = this->new_object("camera"); - camera_object.add_component<Camera>(ivec2{500,500},vec2{500,500},Camera::Data{}); + camera_object.add_component<Camera>(ivec2(990, 720), vec2(1100, 800), + Camera::Data{ + .bg_color = Color::RED, + }); ButtonSubScene button; button.create(*this); diff --git a/src/crepe/api/Config.h b/src/crepe/api/Config.h index 6b9e3ca..c53c2d6 100644 --- a/src/crepe/api/Config.h +++ b/src/crepe/api/Config.h @@ -85,7 +85,7 @@ struct Config final { * This config option is the font size at which all fonts will be loaded initially. * */ - unsigned int size = 16; + unsigned int size = 32; } font; //! Configuration for click tolerance. struct { |