diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-12-20 15:52:54 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-12-20 15:52:54 +0100 |
commit | 667ed9ac9b1e51ef87a5a0bca25566f39f087671 (patch) | |
tree | 1ead85a1eb1559d53ae2fac8d1f2a599c880b46f /game/mainmenu/ButtonSubScene.cpp | |
parent | 0ba89eff9283d5f9f59fa763a19f4616f1c66d74 (diff) |
updated cmake and added simple button
Diffstat (limited to 'game/mainmenu/ButtonSubScene.cpp')
-rw-r--r-- | game/mainmenu/ButtonSubScene.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/game/mainmenu/ButtonSubScene.cpp b/game/mainmenu/ButtonSubScene.cpp new file mode 100644 index 0000000..168b387 --- /dev/null +++ b/game/mainmenu/ButtonSubScene.cpp @@ -0,0 +1,20 @@ +#include "ButtonSubScene.h" +#include "ButtonScript.h" + +#include <crepe/api/BehaviorScript.h> +#include <crepe/api/Sprite.h> +#include <crepe/api/Scene.h> +#include <crepe/api/Button.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<BehaviorScript>().set_script<ButtonScript>(); +} + |