From f2028cd4def82f5f6a52392ff011f6d0fa4aa315 Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Tue, 7 Jan 2025 22:07:32 +0100 Subject: correct naming --- game/menus/ButtonNextMainMenuScript.cpp | 40 ---------------------- game/menus/ButtonNextMainMenuScript.h | 15 -------- game/menus/ButtonNextMainMenuSubScript.cpp | 40 ++++++++++++++++++++++ game/menus/ButtonNextMainMenuSubScript.h | 15 ++++++++ game/menus/ButtonSetMainMenuScript.cpp | 21 ------------ game/menus/ButtonSetMainMenuScript.h | 15 -------- game/menus/ButtonSetMainMenuSubScript.cpp | 21 ++++++++++++ game/menus/ButtonSetMainMenuSubScript.h | 15 ++++++++ game/menus/ButtonSetShopScript.cpp | 16 --------- game/menus/ButtonSetShopScript.h | 15 -------- game/menus/ButtonSetShopSubScript.cpp | 16 +++++++++ game/menus/ButtonSetShopSubScript.h | 15 ++++++++ game/menus/ButtonSubScene.cpp | 16 ++++----- .../mainmenu/ButtonTransitionPreviewScript.cpp | 21 ------------ .../menus/mainmenu/ButtonTransitionPreviewScript.h | 12 ------- .../mainmenu/ButtonTransitionPreviewSubScript.cpp | 21 ++++++++++++ .../mainmenu/ButtonTransitionPreviewSubScript.h | 12 +++++++ game/menus/mainmenu/MainMenuScene.cpp | 4 +-- game/menus/mainmenu/TransitionStartScript.cpp | 15 -------- game/menus/mainmenu/TransitionStartScript.h | 9 ----- game/menus/mainmenu/TransitionStartSubScript.cpp | 15 ++++++++ game/menus/mainmenu/TransitionStartSubScript.h | 9 +++++ 22 files changed, 189 insertions(+), 189 deletions(-) delete mode 100644 game/menus/ButtonNextMainMenuScript.cpp delete mode 100644 game/menus/ButtonNextMainMenuScript.h create mode 100644 game/menus/ButtonNextMainMenuSubScript.cpp create mode 100644 game/menus/ButtonNextMainMenuSubScript.h delete mode 100644 game/menus/ButtonSetMainMenuScript.cpp delete mode 100644 game/menus/ButtonSetMainMenuScript.h create mode 100644 game/menus/ButtonSetMainMenuSubScript.cpp create mode 100644 game/menus/ButtonSetMainMenuSubScript.h delete mode 100644 game/menus/ButtonSetShopScript.cpp delete mode 100644 game/menus/ButtonSetShopScript.h create mode 100644 game/menus/ButtonSetShopSubScript.cpp create mode 100644 game/menus/ButtonSetShopSubScript.h delete mode 100644 game/menus/mainmenu/ButtonTransitionPreviewScript.cpp delete mode 100644 game/menus/mainmenu/ButtonTransitionPreviewScript.h create mode 100644 game/menus/mainmenu/ButtonTransitionPreviewSubScript.cpp create mode 100644 game/menus/mainmenu/ButtonTransitionPreviewSubScript.h delete mode 100644 game/menus/mainmenu/TransitionStartScript.cpp delete mode 100644 game/menus/mainmenu/TransitionStartScript.h create mode 100644 game/menus/mainmenu/TransitionStartSubScript.cpp create mode 100644 game/menus/mainmenu/TransitionStartSubScript.h (limited to 'game/menus') diff --git a/game/menus/ButtonNextMainMenuScript.cpp b/game/menus/ButtonNextMainMenuScript.cpp deleted file mode 100644 index 7ebb2cf..0000000 --- a/game/menus/ButtonNextMainMenuScript.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "ButtonNextMainMenuScript.h" -#include "MenusConfig.h" -#include "ValueBroker.h" - -#include "manager/SaveManager.h" - -#include "../Config.h" - -#include -#include - -using namespace crepe; -using namespace std; - -void ButtonNextMainMenuScript::init(){ - IButtonScript::init(); - this->subscribe([this](const ButtonPressEvent& e) { return this->on_button_press(e); }); -} - -bool ButtonNextMainMenuScript::on_button_press(const ButtonPressEvent& e){ - RefVector audios = this->get_components_by_name("background_music"); - - for (AudioSource & audio : audios) { - audio.stop(); - } - - SaveManager & savemgr = this->get_save_manager(); - - ValueBroker coins = savemgr.get(TOTAL_COINS_RUN,0); - ValueBroker coins_game = savemgr.get(TOTAL_COINS_GAME,0); - savemgr.set(TOTAL_COINS_GAME, coins_game.get()+coins.get()); - - ValueBroker distance = savemgr.get(DISTANCE_RUN,0); - ValueBroker distance_game = savemgr.get(DISTANCE_GAME,0); - if(distance.get() > distance_game.get()) savemgr.set(DISTANCE_GAME, distance.get()); - - this->set_next_scene(MAINMENU_SCENE); - return false; -} - diff --git a/game/menus/ButtonNextMainMenuScript.h b/game/menus/ButtonNextMainMenuScript.h deleted file mode 100644 index b9f70b3..0000000 --- a/game/menus/ButtonNextMainMenuScript.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include "IButtonScript.h" - -#include - -class ButtonNextMainMenuScript : public IButtonScript { -public: - void init() override; - bool on_button_press(const crepe::ButtonPressEvent& e); -private: - float velocity = 20; -protected: - bool transition = false; -}; diff --git a/game/menus/ButtonNextMainMenuSubScript.cpp b/game/menus/ButtonNextMainMenuSubScript.cpp new file mode 100644 index 0000000..d6e315e --- /dev/null +++ b/game/menus/ButtonNextMainMenuSubScript.cpp @@ -0,0 +1,40 @@ +#include "ButtonNextMainMenuSubScript.h" +#include "MenusConfig.h" +#include "ValueBroker.h" + +#include "manager/SaveManager.h" + +#include "../Config.h" + +#include +#include + +using namespace crepe; +using namespace std; + +void ButtonNextMainMenuSubScript::init(){ + IButtonScript::init(); + this->subscribe([this](const ButtonPressEvent& e) { return this->on_button_press(e); }); +} + +bool ButtonNextMainMenuSubScript::on_button_press(const ButtonPressEvent& e){ + RefVector audios = this->get_components_by_name("background_music"); + + for (AudioSource & audio : audios) { + audio.stop(); + } + + SaveManager & savemgr = this->get_save_manager(); + + ValueBroker coins = savemgr.get(TOTAL_COINS_RUN,0); + ValueBroker coins_game = savemgr.get(TOTAL_COINS_GAME,0); + savemgr.set(TOTAL_COINS_GAME, coins_game.get()+coins.get()); + + ValueBroker distance = savemgr.get(DISTANCE_RUN,0); + ValueBroker distance_game = savemgr.get(DISTANCE_GAME,0); + if(distance.get() > distance_game.get()) savemgr.set(DISTANCE_GAME, distance.get()); + + this->set_next_scene(MAINMENU_SCENE); + return false; +} + diff --git a/game/menus/ButtonNextMainMenuSubScript.h b/game/menus/ButtonNextMainMenuSubScript.h new file mode 100644 index 0000000..cb5c8ca --- /dev/null +++ b/game/menus/ButtonNextMainMenuSubScript.h @@ -0,0 +1,15 @@ +#pragma once + +#include "IButtonScript.h" + +#include + +class ButtonNextMainMenuSubScript : public IButtonScript { +public: + void init() override; + bool on_button_press(const crepe::ButtonPressEvent& e); +private: + float velocity = 20; +protected: + bool transition = false; +}; diff --git a/game/menus/ButtonSetMainMenuScript.cpp b/game/menus/ButtonSetMainMenuScript.cpp deleted file mode 100644 index 1e4179c..0000000 --- a/game/menus/ButtonSetMainMenuScript.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "ButtonSetMainMenuScript.h" -#include "MenusConfig.h" - -#include -#include - -using namespace crepe; -using namespace std; - -void ButtonSetMainMenuScript::init(){ - IButtonScript::init(); - this->subscribe([this](const ButtonPressEvent& e) { return this->on_button_press(e); }); -} - -bool ButtonSetMainMenuScript::on_button_press(const ButtonPressEvent& e){ - RefVector audios = this->get_components_by_name("background_music"); - - this->set_next_scene(MAINMENU_SCENE); - return false; -} - diff --git a/game/menus/ButtonSetMainMenuScript.h b/game/menus/ButtonSetMainMenuScript.h deleted file mode 100644 index 13a33bf..0000000 --- a/game/menus/ButtonSetMainMenuScript.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include "IButtonScript.h" - -#include - -class ButtonSetMainMenuScript : public IButtonScript { -public: - void init() override; - bool on_button_press(const crepe::ButtonPressEvent& e); -private: - float velocity = 20; -protected: - bool transition = false; -}; diff --git a/game/menus/ButtonSetMainMenuSubScript.cpp b/game/menus/ButtonSetMainMenuSubScript.cpp new file mode 100644 index 0000000..2181f44 --- /dev/null +++ b/game/menus/ButtonSetMainMenuSubScript.cpp @@ -0,0 +1,21 @@ +#include "ButtonSetMainMenuSubScript.h" +#include "MenusConfig.h" + +#include +#include + +using namespace crepe; +using namespace std; + +void ButtonSetMainMenuSubScript::init(){ + IButtonScript::init(); + this->subscribe([this](const ButtonPressEvent& e) { return this->on_button_press(e); }); +} + +bool ButtonSetMainMenuSubScript::on_button_press(const ButtonPressEvent& e){ + RefVector audios = this->get_components_by_name("background_music"); + + this->set_next_scene(MAINMENU_SCENE); + return false; +} + diff --git a/game/menus/ButtonSetMainMenuSubScript.h b/game/menus/ButtonSetMainMenuSubScript.h new file mode 100644 index 0000000..40e2c11 --- /dev/null +++ b/game/menus/ButtonSetMainMenuSubScript.h @@ -0,0 +1,15 @@ +#pragma once + +#include "IButtonScript.h" + +#include + +class ButtonSetMainMenuSubScript : public IButtonScript { +public: + void init() override; + bool on_button_press(const crepe::ButtonPressEvent& e); +private: + float velocity = 20; +protected: + bool transition = false; +}; diff --git a/game/menus/ButtonSetShopScript.cpp b/game/menus/ButtonSetShopScript.cpp deleted file mode 100644 index 88639bd..0000000 --- a/game/menus/ButtonSetShopScript.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "ButtonSetShopScript.h" -#include "MenusConfig.h" - -using namespace crepe; -using namespace std; - -void ButtonSetShopScript::init(){ - IButtonScript::init(); - this->subscribe([this](const ButtonPressEvent& e) { return this->on_button_press(e); }); -} - -bool ButtonSetShopScript::on_button_press(const ButtonPressEvent& e){ - this->set_next_scene(SHOP_SCENE); - return false; -} - diff --git a/game/menus/ButtonSetShopScript.h b/game/menus/ButtonSetShopScript.h deleted file mode 100644 index 434abc0..0000000 --- a/game/menus/ButtonSetShopScript.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include "IButtonScript.h" - -#include - -class ButtonSetShopScript : public IButtonScript { -public: - void init() override; - bool on_button_press(const crepe::ButtonPressEvent& e); -private: - float velocity = 20; -protected: - bool transition = false; -}; diff --git a/game/menus/ButtonSetShopSubScript.cpp b/game/menus/ButtonSetShopSubScript.cpp new file mode 100644 index 0000000..67005a7 --- /dev/null +++ b/game/menus/ButtonSetShopSubScript.cpp @@ -0,0 +1,16 @@ +#include "ButtonSetShopSubScript.h" +#include "MenusConfig.h" + +using namespace crepe; +using namespace std; + +void ButtonSetShopSubScript::init(){ + IButtonScript::init(); + this->subscribe([this](const ButtonPressEvent& e) { return this->on_button_press(e); }); +} + +bool ButtonSetShopSubScript::on_button_press(const ButtonPressEvent& e){ + this->set_next_scene(SHOP_SCENE); + return false; +} + diff --git a/game/menus/ButtonSetShopSubScript.h b/game/menus/ButtonSetShopSubScript.h new file mode 100644 index 0000000..8edc7bf --- /dev/null +++ b/game/menus/ButtonSetShopSubScript.h @@ -0,0 +1,15 @@ +#pragma once + +#include "IButtonScript.h" + +#include + +class ButtonSetShopSubScript : public IButtonScript { +public: + void init() override; + bool on_button_press(const crepe::ButtonPressEvent& e); +private: + float velocity = 20; +protected: + bool transition = false; +}; diff --git a/game/menus/ButtonSubScene.cpp b/game/menus/ButtonSubScene.cpp index ea0df8a..5f7f2b0 100644 --- a/game/menus/ButtonSubScene.cpp +++ b/game/menus/ButtonSubScene.cpp @@ -1,11 +1,11 @@ #include "ButtonSubScene.h" -#include "ButtonNextMainMenuScript.h" -#include "ButtonSetMainMenuScript.h" -#include "ButtonSetShopScript.h" +#include "ButtonNextMainMenuSubScript.h" +#include "ButtonSetMainMenuSubScript.h" +#include "ButtonSetShopSubScript.h" #include "IButtonScript.h" #include "MenusConfig.h" -#include "mainmenu/ButtonTransitionPreviewScript.h" +#include "mainmenu/ButtonTransitionPreviewSubScript.h" #include "../Config.h" @@ -39,16 +39,16 @@ void ButtonSubScene::btn_text(crepe::GameObject & button_object,const Data & dat void ButtonSubScene::set_script(crepe::GameObject & button_object,const Data & data){ switch (data.script_type) { case ScriptSelect::PREVIEW: - button_object.add_component().set_script(); + button_object.add_component().set_script(); break; case ScriptSelect::SHOP: - button_object.add_component().set_script(); + button_object.add_component().set_script(); break; case ScriptSelect::MAINMENU: - button_object.add_component().set_script(); + button_object.add_component().set_script(); break; case ScriptSelect::NEXT: - button_object.add_component().set_script(); + button_object.add_component().set_script(); break; case ScriptSelect::NONE: button_object.add_component().set_script(); diff --git a/game/menus/mainmenu/ButtonTransitionPreviewScript.cpp b/game/menus/mainmenu/ButtonTransitionPreviewScript.cpp deleted file mode 100644 index 084d02b..0000000 --- a/game/menus/mainmenu/ButtonTransitionPreviewScript.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "ButtonTransitionPreviewScript.h" - -#include "../MenusConfig.h" - -using namespace crepe; -using namespace std; - -void ButtonTransitionPreviewScript::init(){ - IButtonScript::init(); - this->subscribe([this](const ButtonPressEvent& e) { return this->on_button_press(e); }); -} - -bool ButtonTransitionPreviewScript::on_button_press(const ButtonPressEvent& e){ - if(!this->transition) this->transition = true; - return false; -} - -const char* ButtonTransitionPreviewScript::get_scene_name() const { - // Provide the next scene defined in MainMenuConfig - return PREVIEW_SCENE; -} diff --git a/game/menus/mainmenu/ButtonTransitionPreviewScript.h b/game/menus/mainmenu/ButtonTransitionPreviewScript.h deleted file mode 100644 index 5973dbf..0000000 --- a/game/menus/mainmenu/ButtonTransitionPreviewScript.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include "ITransitionScript.h" - -#include "../IButtonScript.h" - -class ButtonTransitionPreviewScript : public ITransitionScript, public IButtonScript { -public: - void init() override; - bool on_button_press(const crepe::ButtonPressEvent& e); - const char* get_scene_name() const override; -}; diff --git a/game/menus/mainmenu/ButtonTransitionPreviewSubScript.cpp b/game/menus/mainmenu/ButtonTransitionPreviewSubScript.cpp new file mode 100644 index 0000000..8c055ec --- /dev/null +++ b/game/menus/mainmenu/ButtonTransitionPreviewSubScript.cpp @@ -0,0 +1,21 @@ +#include "ButtonTransitionPreviewSubScript.h" + +#include "../MenusConfig.h" + +using namespace crepe; +using namespace std; + +void ButtonTransitionPreviewSubScript::init(){ + IButtonScript::init(); + this->subscribe([this](const ButtonPressEvent& e) { return this->on_button_press(e); }); +} + +bool ButtonTransitionPreviewSubScript::on_button_press(const ButtonPressEvent& e){ + if(!this->transition) this->transition = true; + return false; +} + +const char* ButtonTransitionPreviewSubScript::get_scene_name() const { + // Provide the next scene defined in MainMenuConfig + return PREVIEW_SCENE; +} diff --git a/game/menus/mainmenu/ButtonTransitionPreviewSubScript.h b/game/menus/mainmenu/ButtonTransitionPreviewSubScript.h new file mode 100644 index 0000000..6e6b0b2 --- /dev/null +++ b/game/menus/mainmenu/ButtonTransitionPreviewSubScript.h @@ -0,0 +1,12 @@ +#pragma once + +#include "ITransitionScript.h" + +#include "../IButtonScript.h" + +class ButtonTransitionPreviewSubScript : public ITransitionScript, public IButtonScript { +public: + void init() override; + bool on_button_press(const crepe::ButtonPressEvent& e); + const char* get_scene_name() const override; +}; diff --git a/game/menus/mainmenu/MainMenuScene.cpp b/game/menus/mainmenu/MainMenuScene.cpp index 15cf6d5..e0dfbee 100644 --- a/game/menus/mainmenu/MainMenuScene.cpp +++ b/game/menus/mainmenu/MainMenuScene.cpp @@ -1,6 +1,6 @@ #include "MainMenuScene.h" -#include "TransitionStartScript.h" +#include "TransitionStartSubScript.h" #include "MainMenuConfig.h" #include "../ButtonSubScene.h" @@ -29,7 +29,7 @@ void MainMenuScene::load_scene(){ Camera::Data{ .bg_color = Color::RED, }); - camera_object.add_component().set_script(); + camera_object.add_component().set_script(); //Button menu diff --git a/game/menus/mainmenu/TransitionStartScript.cpp b/game/menus/mainmenu/TransitionStartScript.cpp deleted file mode 100644 index 9b395de..0000000 --- a/game/menus/mainmenu/TransitionStartScript.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "TransitionStartScript.h" - -#include "../MenusConfig.h" - -using namespace crepe; -using namespace std; - -void TransitionStartScript::fixed_update(crepe::duration_t dt){ - if(this->get_key_state(Keycode::ENTER) && this->transition == false) this->transition = true; -} - -const char* TransitionStartScript::get_scene_name() const { - // Provide the next scene defined in MainMenuConfig - return START_SCENE; -} diff --git a/game/menus/mainmenu/TransitionStartScript.h b/game/menus/mainmenu/TransitionStartScript.h deleted file mode 100644 index c6df1b9..0000000 --- a/game/menus/mainmenu/TransitionStartScript.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include "ITransitionScript.h" - -class TransitionStartScript : public ITransitionScript { -public: - void fixed_update(crepe::duration_t dt) override; - const char* get_scene_name() const override; -}; diff --git a/game/menus/mainmenu/TransitionStartSubScript.cpp b/game/menus/mainmenu/TransitionStartSubScript.cpp new file mode 100644 index 0000000..6ad4673 --- /dev/null +++ b/game/menus/mainmenu/TransitionStartSubScript.cpp @@ -0,0 +1,15 @@ +#include "TransitionStartSubScript.h" + +#include "../MenusConfig.h" + +using namespace crepe; +using namespace std; + +void TransitionStartSubScript::fixed_update(crepe::duration_t dt){ + if(this->get_key_state(Keycode::ENTER) && this->transition == false) this->transition = true; +} + +const char* TransitionStartSubScript::get_scene_name() const { + // Provide the next scene defined in MainMenuConfig + return START_SCENE; +} diff --git a/game/menus/mainmenu/TransitionStartSubScript.h b/game/menus/mainmenu/TransitionStartSubScript.h new file mode 100644 index 0000000..b41360d --- /dev/null +++ b/game/menus/mainmenu/TransitionStartSubScript.h @@ -0,0 +1,9 @@ +#pragma once + +#include "ITransitionScript.h" + +class TransitionStartSubScript : public ITransitionScript { +public: + void fixed_update(crepe::duration_t dt) override; + const char* get_scene_name() const override; +}; -- cgit v1.2.3