From aa8bf26452157f81f72b6d6759e461ff2ca24568 Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Wed, 8 Jan 2025 13:40:20 +0100 Subject: updated preview and added credits button --- game/menus/mainmenu/CreditsSubScene.cpp | 68 ++++++++++++++++++++++++++++++++ game/menus/mainmenu/CreditsSubScene.h | 9 +++++ game/menus/mainmenu/CreditsSubScript.cpp | 46 +++++++++++++++++++++ game/menus/mainmenu/CreditsSubScript.h | 14 +++++++ game/menus/mainmenu/MainMenuScene.cpp | 15 ++++++- 5 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 game/menus/mainmenu/CreditsSubScene.cpp create mode 100644 game/menus/mainmenu/CreditsSubScene.h create mode 100644 game/menus/mainmenu/CreditsSubScript.cpp create mode 100644 game/menus/mainmenu/CreditsSubScript.h (limited to 'game/menus/mainmenu') diff --git a/game/menus/mainmenu/CreditsSubScene.cpp b/game/menus/mainmenu/CreditsSubScene.cpp new file mode 100644 index 0000000..9a49257 --- /dev/null +++ b/game/menus/mainmenu/CreditsSubScene.cpp @@ -0,0 +1,68 @@ + +#include "CreditsSubScene.h" +#include "CreditsSubScript.h" +#include "EndGameSubScript.h" + +#include "../../Config.h" +#include "../ButtonSubScene.h" +#include "../FloatingWindowSubScene.h" + +#include + +#include +#include +#include +#include + +using namespace crepe; +using namespace std; + +void CreditsSubScene::create(Scene & scn) { + + const std::string TAG = "end_game_tag"; + GameObject script = scn.new_object("script"); + script.add_component().set_script(TAG); + + // Window + FloatingWindowSubScene window; + window.create( + scn, + FloatingWindowSubScene::Data { + .group_tag = TAG, + .width = 500, + .offset = {0, -50}, + .width_middle_offset = -2, + } + ); + + // Titel + const string TITEL_STRING = "Credits"; + GameObject titel = scn.new_object("titel", TAG); + crepe::vec2 size = {200, (200.0f / TITEL_STRING.size()) * 2}; + titel.add_component( + size, FONT, + Text::Data { + .world_space = false, + .text_color = Color::WHITE, + }, + vec2 {0, -207} + FONTOFFSET, TITEL_STRING + ); + + // Buttons + vec2 button_position = {190, 190}; + ButtonSubScene button; + button.create( + scn, + ButtonSubScene::Data { + .text = "Back", + .text_width = 150, + .position = {-button_position.x, button_position.y}, + //.script_type = ButtonSubScene::ScriptSelect::REPLAY, + //.button_type = ButtonSubScene::ButtonSelect::BACK, + .scale = 0.6, + .worldspace = false, + .tag = TAG, + .sorting_layer_offset = 20, + } + ); +} diff --git a/game/menus/mainmenu/CreditsSubScene.h b/game/menus/mainmenu/CreditsSubScene.h new file mode 100644 index 0000000..e7ff735 --- /dev/null +++ b/game/menus/mainmenu/CreditsSubScene.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +class CreditsSubScene { + +public: + void create(crepe::Scene & scn); +}; diff --git a/game/menus/mainmenu/CreditsSubScript.cpp b/game/menus/mainmenu/CreditsSubScript.cpp new file mode 100644 index 0000000..5326594 --- /dev/null +++ b/game/menus/mainmenu/CreditsSubScript.cpp @@ -0,0 +1,46 @@ +#include "CreditsSubScript.h" + +#include "../../Events.h" +#include "../IFloatingWindowScript.h" +#include "../ButtonReplaySubScript.h" + +#include + +#include +#include +#include +#include + +using namespace crepe; + +CreditsSubScript::CreditsSubScript(const std::string & tag) { this->tag = tag; } + +void CreditsSubScript::init() { + this->disable_all(); +} + +bool CreditsSubScript::disable_all() { + IFloatingWindowScript::disable_all_sprites(); + RefVector