diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2025-01-08 19:57:34 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2025-01-08 19:57:34 +0100 |
commit | 0a57018881fc530e18695ed3331482f432bb7750 (patch) | |
tree | 46c37585e83caa1abf2a1f48c6c8c8b0cae5de2b /game/menus/ButtonSubScene.cpp | |
parent | 30974f588816aa03652002111c6a946b138e3bc5 (diff) |
added color to button
Diffstat (limited to 'game/menus/ButtonSubScene.cpp')
-rw-r--r-- | game/menus/ButtonSubScene.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/game/menus/ButtonSubScene.cpp b/game/menus/ButtonSubScene.cpp index 2c912b7..436ff5f 100644 --- a/game/menus/ButtonSubScene.cpp +++ b/game/menus/ButtonSubScene.cpp @@ -10,6 +10,7 @@ #include "../preview/PreviewReplaySubScript.h" #include "../preview/PreviewStartRecSubScript.h" #include "../preview/PreviewStopRecSubScript.h" +#include "api/Asset.h" #include "mainmenu/ButtonTransitionPreviewSubScript.h" #include "../Config.h" @@ -211,8 +212,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, @@ -221,7 +245,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, |