diff options
Diffstat (limited to 'src/plugins.hpp')
| -rw-r--r-- | src/plugins.hpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/plugins.hpp b/src/plugins.hpp index 2f34c12..64c19f0 100644 --- a/src/plugins.hpp +++ b/src/plugins.hpp @@ -1,16 +1,32 @@ #ifndef PKE_PLUGINS_HPP #define PKE_PLUGINS_HPP +#include "array.hpp" +#include "dynamic-array.hpp" + struct PKEPluginInterface { + // for internal use only + void *pluginHandle = nullptr; void (*OnInit)() = nullptr; void (*OnTick)(double delta) = nullptr; void (*OnTeardown)() = nullptr; void (*OnImGuiRender)() = nullptr; }; -extern PKEPluginInterface pkePlugin; +using CallbackSignature = char[16]; +struct PkeCallback { + // the 16 char signature(name) of a function + CallbackSignature name = {'\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0'}; + // the address of the function to call - populated on startup + void *func = nullptr; +}; + +extern DynArray<PKEPluginInterface> LoadedPkePlugins; +extern PkeArray<PkeCallback> pkePluginCallbacks; -void Pke_LoadPlugin(const char *path); -void Pke_UnloadPlugin(); +void PkePlugin_Load(const char *path); +PkeCallback *PkePlugin_FindSignature(const CallbackSignature &sig); +void PkePlugin_SetSignatureFunc(PkeCallback *sig); +CallbackSignature *PkePlugin_GetSortedSignatures(long &count); #endif /* PKE_PLUGINS_HPP */ |
