diff --git a/Nuake/Source/Nuake/Modules/ExampleModule/ExampleModule.cpp b/Nuake/Source/Nuake/Modules/ExampleModule/ExampleModule.cpp index 79609f1b..b7d7c748 100644 --- a/Nuake/Source/Nuake/Modules/ExampleModule/ExampleModule.cpp +++ b/Nuake/Source/Nuake/Modules/ExampleModule/ExampleModule.cpp @@ -71,17 +71,30 @@ void ExampleModule_Startup() TestClass::InternalInitializeClass(); + // Register the module & info auto& module = ModuleDB::Get().RegisterModule(); module.instance = module.Resolve().construct(); - module.Description = "This is an example module"; + // This is to expose parameters in the modules settings module.RegisterSetting<&mySetting>("mySetting"); // This is to expose functions to the rest of the engine module.BindFunction("ExampleFunction"); module.BindFunction("ExampleModuleLog", "hi"); - //module.Invoke("ExampleModuleLog", "Hello World"); + + // The module can hook to certain events + module.OnUpdate.AddStatic([](float ts) + { + + }); + + module.OnFixedUpdate.AddStatic([](float ts) + { + + }); + + entt::id_type typeId = entt::hashed_string(TestClass::ClassName().c_str()); entt::meta_type metaType = entt::resolve(typeId); @@ -157,8 +170,6 @@ void ExampleModule_Startup() //Logger::Log("Serialized original component: " + jsonDataOG.dump(4), "ExampleModule", VERBOSE); } - - void ExampleModule_Shutdown() { diff --git a/Nuake/Source/Nuake/Modules/ModuleDB.h b/Nuake/Source/Nuake/Modules/ModuleDB.h index 16a7210a..c51a0941 100644 --- a/Nuake/Source/Nuake/Modules/ModuleDB.h +++ b/Nuake/Source/Nuake/Modules/ModuleDB.h @@ -4,11 +4,14 @@ #include #include +#include "Nuake/Core/Logger.h" +#include "Nuake/Core/GameState.h" +#include "Nuake/Core/MulticastDelegate.h" #include "Nuake/Core/Object/Object.h" +#include "Nuake/Scene/Scene.h" #include -#include "Nuake/Core/Logger.h" class ModuleInstance { public: @@ -21,7 +24,10 @@ public: return entt::resolve(entt::hashed_string(Name.c_str())); } - + MulticastDelegate> OnSceneLoad; + MulticastDelegate OnUpdate; + MulticastDelegate OnFixedUpdate; + MulticastDelegate OnGameStateChanged; }; class Class