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/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 +++++++ 8 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 src/crepe/api/Components.h (limited to 'src/crepe/api') 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