diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2025-01-10 14:17:38 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2025-01-10 14:17:38 +0100 |
commit | 52c838538d2271134a2c5a128074ea9c2ed1d4a3 (patch) | |
tree | fd85a4193f88ec48c77d6fbfd90e909ac3a5855c /game/PreviewScene.cpp | |
parent | 15a958a7f327bb2e81e7d445f1499ec78c7f5839 (diff) | |
parent | bb2db93bfb8dd7e080d2708548eae660e6b33913 (diff) |
Merge branch 'master' into niels/game
Diffstat (limited to 'game/PreviewScene.cpp')
-rw-r--r-- | game/PreviewScene.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/game/PreviewScene.cpp b/game/PreviewScene.cpp index 6cd9e78..6871961 100644 --- a/game/PreviewScene.cpp +++ b/game/PreviewScene.cpp @@ -2,6 +2,10 @@ #include "Config.h" #include "background/BackgroundSubScene.h" +#include "hud/HudScript.h" +#include "hud/HudSubScene.h" +#include "hud/SpeedScript.h" +#include "menus/ButtonSubScene.h" #include "missile/MissilePool.h" #include "missile/SpawnEvent.h" #include "preview/NpcSubScene.h" @@ -47,6 +51,8 @@ void PreviewScene::load_scene() { ); camera.add_component<Rigidbody>(Rigidbody::Data {}); camera.add_component<BehaviorScript>().set_script<MissileSpawnEventHandler>(); + camera.add_component<BehaviorScript>().set_script<HudScript>(); + camera.add_component<BehaviorScript>().set_script<SpeedScript>(); GameObject floor = new_object("floor", "game_world", vec2(0, 325)); floor.add_component<Rigidbody>(Rigidbody::Data { @@ -83,6 +89,77 @@ void PreviewScene::load_scene() { SmokeSubScene smoke(*this); MissilePool mpool(*this); + HudSubScene hud; + hud.create(*this); + + + const float Y_POS_BUTTONS = -220; + const float X_POS_BUTTONS = -150; + const float X_POS_BUTTONS_SPACING = 145; + ButtonSubScene button; + button.create( + *this, + ButtonSubScene::Data { + .text = "BACK", + .text_width = 60, + .position = {X_POS_BUTTONS,Y_POS_BUTTONS}, + .script_type = ButtonSubScene::ScriptSelect::NEXT, + .button_type = ButtonSubScene::ButtonSelect::BACK, + .scale = 0.6, + .worldspace = false, + .tag = "Next button", + .sorting_layer_offset = 20, + } + ); + + button.create( + *this, + ButtonSubScene::Data { + .text = "START REC", + .text_width = 130, + .position = {X_POS_BUTTONS+X_POS_BUTTONS_SPACING,Y_POS_BUTTONS}, + .script_type = ButtonSubScene::ScriptSelect::PREVIEW_START, + .button_type = ButtonSubScene::ButtonSelect::LARGE, + .scale = 0.6, + .worldspace = false, + .tag = "Next button", + .sorting_layer_offset = 20, + .btn_side_color = ButtonSubScene::ButtonSideColor::YELLOW, + } + ); + + button.create( + *this, + ButtonSubScene::Data { + .text = "STOP REC", + .text_width = 120, + .position = {X_POS_BUTTONS+X_POS_BUTTONS_SPACING*2,Y_POS_BUTTONS}, + .script_type = ButtonSubScene::ScriptSelect::PREVIEW_STOP, + .button_type = ButtonSubScene::ButtonSelect::LARGE, + .scale = 0.6, + .worldspace = false, + .tag = "Next button", + .sorting_layer_offset = 20, + .btn_side_color = ButtonSubScene::ButtonSideColor::BLUE, + } + ); + + button.create( + *this, + ButtonSubScene::Data { + .text = "REPLAY", + .text_width = 90, + .position = {X_POS_BUTTONS+X_POS_BUTTONS_SPACING*3,Y_POS_BUTTONS}, + .script_type = ButtonSubScene::ScriptSelect::PREVIEW_REPLAY, + .button_type = ButtonSubScene::ButtonSelect::LARGE, + .scale = 0.6, + .worldspace = false, + .tag = "Next button", + .sorting_layer_offset = 20, + .btn_side_color = ButtonSubScene::ButtonSideColor::ORANGE, + } + ); + /* for (int i = 0; i < 200; ++i) { |