1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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;
};
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 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 */
|