diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/crepe/system/ScriptSystem.cpp | 8 | ||||
-rw-r--r-- | src/crepe/system/ScriptSystem.h | 5 | ||||
-rw-r--r-- | src/crepe/system/System.h | 14 | ||||
-rw-r--r-- | src/example/script.cpp | 2 |
4 files changed, 4 insertions, 25 deletions
diff --git a/src/crepe/system/ScriptSystem.cpp b/src/crepe/system/ScriptSystem.cpp index f1fae4d..f2673e7 100644 --- a/src/crepe/system/ScriptSystem.cpp +++ b/src/crepe/system/ScriptSystem.cpp @@ -12,14 +12,6 @@ using namespace std; using namespace crepe; -ScriptSystem::ScriptSystem() { dbg_trace(); } -ScriptSystem::~ScriptSystem() { dbg_trace(); } - -ScriptSystem & ScriptSystem::get_instance() { - static ScriptSystem instance; - return instance; -} - void ScriptSystem::update() { using namespace std; dbg_trace(); diff --git a/src/crepe/system/ScriptSystem.h b/src/crepe/system/ScriptSystem.h index 32e793c..4fa6141 100644 --- a/src/crepe/system/ScriptSystem.h +++ b/src/crepe/system/ScriptSystem.h @@ -10,14 +10,9 @@ class Script; class ScriptSystem : public System { public: - static ScriptSystem & get_instance(); void update(); private: - ScriptSystem(); - ~ScriptSystem(); - -private: // TODO: to forward_list<reference_wrapper> std::forward_list<Script *> get_scripts(); }; diff --git a/src/crepe/system/System.h b/src/crepe/system/System.h index ecbb7f5..3b81bef 100644 --- a/src/crepe/system/System.h +++ b/src/crepe/system/System.h @@ -4,19 +4,11 @@ namespace crepe { class System { public: - static System & get_instance(); virtual void update() = 0; -protected: - System() {}; - virtual ~System() {}; - -private: - // singleton - System(const System &) = delete; - System(System &&) = delete; - System & operator=(const System &) = delete; - System & operator=(System &&) = delete; +public: + System() = default; + virtual ~System() = default; }; } // namespace crepe diff --git a/src/example/script.cpp b/src/example/script.cpp index 928eddf..8ca4ceb 100644 --- a/src/example/script.cpp +++ b/src/example/script.cpp @@ -41,7 +41,7 @@ int main() { // Get ScriptSystem singleton instance (this would normally be done from the // game loop) - auto & sys = ScriptSystem::get_instance(); + ScriptSystem sys; // Update all scripts. This should result in MyScript::update being called sys.update(); |