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 | |
parent | 30974f588816aa03652002111c6a946b138e3bc5 (diff) |
added color to button
-rw-r--r-- | game/PreviewScene.cpp | 3 | ||||
-rw-r--r-- | game/menus/ButtonSubScene.cpp | 28 | ||||
-rw-r--r-- | game/menus/ButtonSubScene.h | 9 | ||||
-rw-r--r-- | game/menus/mainmenu/MainMenuScene.cpp | 3 |
4 files changed, 41 insertions, 2 deletions
diff --git a/game/PreviewScene.cpp b/game/PreviewScene.cpp index 0812c0d..6871961 100644 --- a/game/PreviewScene.cpp +++ b/game/PreviewScene.cpp @@ -124,6 +124,7 @@ void PreviewScene::load_scene() { .worldspace = false, .tag = "Next button", .sorting_layer_offset = 20, + .btn_side_color = ButtonSubScene::ButtonSideColor::YELLOW, } ); @@ -139,6 +140,7 @@ void PreviewScene::load_scene() { .worldspace = false, .tag = "Next button", .sorting_layer_offset = 20, + .btn_side_color = ButtonSubScene::ButtonSideColor::BLUE, } ); @@ -154,6 +156,7 @@ void PreviewScene::load_scene() { .worldspace = false, .tag = "Next button", .sorting_layer_offset = 20, + .btn_side_color = ButtonSubScene::ButtonSideColor::ORANGE, } ); 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, diff --git a/game/menus/ButtonSubScene.h b/game/menus/ButtonSubScene.h index 29287b6..8f086f0 100644 --- a/game/menus/ButtonSubScene.h +++ b/game/menus/ButtonSubScene.h @@ -36,6 +36,14 @@ public: NEXT, LARGE, }; + + enum class ButtonSideColor { + BLUE, + ORANGE, + PURPLE, + YELLOW, + NONE, + }; //data struct struct Data { const std::string & text = "NODATA"; @@ -51,6 +59,7 @@ public: const bool color_side = true; const std::string & tag = ""; const int sorting_layer_offset = 0; + const ButtonSideColor btn_side_color = ButtonSideColor::NONE; }; public: diff --git a/game/menus/mainmenu/MainMenuScene.cpp b/game/menus/mainmenu/MainMenuScene.cpp index fba90ac..ff94e74 100644 --- a/game/menus/mainmenu/MainMenuScene.cpp +++ b/game/menus/mainmenu/MainMenuScene.cpp @@ -55,6 +55,7 @@ void MainMenuScene::load_scene() { .text_width = 200, .position = pos_btn, .script_type = ButtonSubScene::ScriptSelect::PREVIEW, + .btn_side_color = ButtonSubScene::ButtonSideColor::PURPLE, } ); @@ -70,6 +71,7 @@ void MainMenuScene::load_scene() { .icon_type = ButtonSubScene::IconSelect::SHOP, .position = pos_btn, .script_type = ButtonSubScene::ScriptSelect::SHOP, + .btn_side_color = ButtonSubScene::ButtonSideColor::ORANGE, } ); @@ -83,6 +85,7 @@ void MainMenuScene::load_scene() { .text_width = 200, .position = pos_btn, .script_type = ButtonSubScene::ScriptSelect::CREDITS_SHOW, + .btn_side_color = ButtonSubScene::ButtonSideColor::BLUE, } ); |