From 7e12ebdf945d40d6f11872cf5852c9bb54d1864f Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sun, 22 Dec 2024 16:12:31 +0100 Subject: big WIP --- src/crepe/Collider.h | 3 +++ src/crepe/api/BehaviorScript.cpp | 18 ++++++++++++++++++ src/crepe/api/BehaviorScript.h | 6 ++++++ src/crepe/api/BehaviorScript.hpp | 1 + src/crepe/api/Components.h | 16 ++++++++++++++++ src/crepe/api/Config.h | 3 ++- src/crepe/api/Engine.cpp | 27 ++++++++++++++++++++------- src/crepe/api/Engine.h | 5 +++++ src/crepe/api/GameObject.h | 7 +++++++ src/crepe/facade/CMakeLists.txt | 2 ++ src/crepe/facade/SignalCatch.cpp | 25 +++++++++++++++++++++++++ src/crepe/facade/SignalCatch.h | 24 ++++++++++++++++++++++++ src/crepe/manager/SystemManager.cpp | 24 ++++++++++++++++-------- src/crepe/manager/SystemManager.h | 13 ++++++++++--- src/crepe/manager/SystemManager.hpp | 5 ++++- src/crepe/system/ScriptSystem.cpp | 15 ++++++++++++--- 16 files changed, 171 insertions(+), 23 deletions(-) create mode 100644 src/crepe/api/Components.h create mode 100644 src/crepe/facade/SignalCatch.cpp create mode 100644 src/crepe/facade/SignalCatch.h (limited to 'src/crepe') diff --git a/src/crepe/Collider.h b/src/crepe/Collider.h index 42ccfd4..4344f15 100644 --- a/src/crepe/Collider.h +++ b/src/crepe/Collider.h @@ -5,6 +5,9 @@ namespace crepe { +/** + * \brief Base collider class + */ class Collider : public Component { public: Collider(game_object_id_t id, const vec2 & offset); diff --git a/src/crepe/api/BehaviorScript.cpp b/src/crepe/api/BehaviorScript.cpp index af7572c..e1c06b0 100644 --- a/src/crepe/api/BehaviorScript.cpp +++ b/src/crepe/api/BehaviorScript.cpp @@ -13,3 +13,21 @@ BehaviorScript & GameObject::add_component() { ComponentManager & mgr = this->mediator.component_manager; return mgr.add_component(this->id, this->mediator); } + +BehaviorScript::BehaviorScript(const BehaviorScript & other) : mediator(other.mediator), Component(other.game_object_id) { + Log::logf("COPY CONSTRUCTOR!!!"); +} + +BehaviorScript::BehaviorScript(BehaviorScript && other) : mediator(other.mediator), Component(other.game_object_id) { + Log::logf("MOVE CONSTRUCTOR!!!"); +} + +BehaviorScript & BehaviorScript::operator = (const BehaviorScript & other) { + Log::logf("COPY OPERATOR!!!"); + return *this; +} + +BehaviorScript & BehaviorScript::operator = (BehaviorScript && other) { + Log::logf("MOVE OPERATOR!!!"); + return *this; +} diff --git a/src/crepe/api/BehaviorScript.h b/src/crepe/api/BehaviorScript.h index 3909b96..52a7cbf 100644 --- a/src/crepe/api/BehaviorScript.h +++ b/src/crepe/api/BehaviorScript.h @@ -33,6 +33,11 @@ protected: //! Only ComponentManager is allowed to instantiate BehaviorScript friend class ComponentManager; + BehaviorScript(const BehaviorScript &); + BehaviorScript(BehaviorScript &&); + BehaviorScript & operator = (const BehaviorScript &); + BehaviorScript & operator = (BehaviorScript &&); + public: /** * \brief Set the concrete script of this component @@ -48,6 +53,7 @@ public: BehaviorScript & set_script(Args &&... args); protected: + std::string name = "unknown script"; //! Script instance std::unique_ptr