diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2025-01-10 14:50:50 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2025-01-10 14:50:50 +0100 |
commit | 7aa07561a52016007ff852acefa4db68260f0f1e (patch) | |
tree | ac438e906e581ee68f9d065dea90a2cbb8436d15 /game/menus/ButtonSubScene.cpp | |
parent | d7c8cc30e1d37526cf142f950038500b96760514 (diff) | |
parent | 0f8bf257d86b5532f3d6f559e5368668c255af7c (diff) |
Merge branch 'master' of https://github.com/lonkaars/crepe into wouter/game-improvements
Diffstat (limited to 'game/menus/ButtonSubScene.cpp')
-rw-r--r-- | game/menus/ButtonSubScene.cpp | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/game/menus/ButtonSubScene.cpp b/game/menus/ButtonSubScene.cpp index 30646f1..1fe6b03 100644 --- a/game/menus/ButtonSubScene.cpp +++ b/game/menus/ButtonSubScene.cpp @@ -7,10 +7,16 @@ #include "IButtonScript.h" #include "MenusConfig.h" +#include "../preview/PreviewReplaySubScript.h" +#include "../preview/PreviewStartRecSubScript.h" +#include "../preview/PreviewStopRecSubScript.h" +#include "api/Asset.h" #include "mainmenu/ButtonTransitionPreviewSubScript.h" #include "../Config.h" #include "mainmenu/CreditsSubScript.h" +#include "menus/shop/ButtonBuySelectBubbleScript.h" +#include "menus/shop/ButtonBuySelectBulletScript.h" #include <crepe/api/BehaviorScript.h> #include <crepe/api/Button.h> @@ -72,6 +78,25 @@ void ButtonSubScene::set_script(crepe::GameObject & button_object, const Data & button_object.add_component<BehaviorScript>() .set_script<ButtonShowCreditsSubScript>(); break; + case ScriptSelect::PREVIEW_REPLAY: + button_object.add_component<BehaviorScript>().set_script<PreviewReplaySubScript>(); + break; + case ScriptSelect::PREVIEW_START: + button_object.add_component<BehaviorScript>().set_script<PreviewStartRecSubScript>( + ); + break; + case ScriptSelect::PREVIEW_STOP: + button_object.add_component<BehaviorScript>().set_script<PreviewStopRecSubScript>( + ); + break; + case ScriptSelect::SHOP_BULLET: + button_object.add_component<BehaviorScript>() + .set_script<ButtonBuySelectBulletScript>(); + break; + case ScriptSelect::SHOP_BUBBLE: + button_object.add_component<BehaviorScript>() + .set_script<ButtonBuySelectBubbleScript>(); + break; case ScriptSelect::NONE: button_object.add_component<BehaviorScript>().set_script<IButtonScript>(); break; @@ -196,8 +221,31 @@ void ButtonSubScene::next_btn_overlay(crepe::GameObject & button_object, const D void ButtonSubScene::btn_color_side( crepe::GameObject & button_object, const vec2 & offset, const Data & data ) { + Asset * selected; + Asset blue = Asset("asset/ui/buttonSmallBlue.png"); + Asset orange = Asset("asset/ui/buttonSmallOrange.png"); + Asset purple = Asset("asset/ui/buttonSmallPurple.png"); + Asset yellow = Asset("asset/ui/buttonSmallYellow.png"); + switch (data.btn_side_color) { + case ButtonSideColor::BLUE: + selected = &blue; + break; + case ButtonSideColor::ORANGE: + selected = &orange; + break; + case ButtonSideColor::PURPLE: + selected = &purple; + break; + case ButtonSideColor::YELLOW: + selected = &yellow; + break; + case ButtonSideColor::NONE: + selected = &blue; + break; + } + button_object.add_component<Sprite>( - Asset("asset/ui/buttonSmallBlue.png"), + *selected, Sprite::Data { .sorting_in_layer = STARTING_SORTING_IN_LAYER + 2 + data.sorting_layer_offset, .size = SIDE_PANEL_SIZE, @@ -206,7 +254,7 @@ void ButtonSubScene::btn_color_side( } ); button_object.add_component<Sprite>( - Asset("asset/ui/buttonSmallBlue.png"), + *selected, Sprite::Data { .flip = {true, false}, .sorting_in_layer = STARTING_SORTING_IN_LAYER + 2 + data.sorting_layer_offset, |