From b1d926361b9d613ad712ad161f9a8b7ccab4551d Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Thu, 27 Jun 2024 21:22:50 -0400 Subject: checkpoint: more explicit callback system --- src/plugin-types.hpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/plugin-types.hpp') diff --git a/src/plugin-types.hpp b/src/plugin-types.hpp index 22f9707..10139b0 100644 --- a/src/plugin-types.hpp +++ b/src/plugin-types.hpp @@ -2,6 +2,21 @@ #define PKE_PLUGIN_TYPES_HPP #include +#include + +constexpr int64_t CallbackSignatureLength = 16; +using CallbackSignature = char[CallbackSignatureLength]; + +typedef void (*ParseDelegate)(std::ifstream *stream); +typedef void (*SerializeDelegate)(std::ifstream *stream); +typedef void (*CollisionDelegate)(const void *entHandleLeft, const void *entHandleRight); + +struct PkeEntityTypeInterface { + void (*OnParse)(std::ifstream *stream) = nullptr; + void (*OnSerialize)(std::ostringstream *stream, void *obj) = nullptr; + void (*OnEntityTypeCollision)(const void *entHandleLeft, const void *entHandleRight) = nullptr; + void (*OnEntityInstanceCollision)(const void *entHandleLeft, const void *entHandleRight) = nullptr; +}; struct PKEPluginInterface { // for internal use only @@ -10,11 +25,10 @@ struct PKEPluginInterface { void (*OnTick)(double delta) = nullptr; void (*OnTeardown)() = nullptr; void (*OnImGuiRender)() = nullptr; + void *PkeEntityInterface = nullptr; + std::size_t PkeEntityInterfaceCount = 0; }; -constexpr int64_t CallbackSignatureLength = 16; -using CallbackSignature = char[CallbackSignatureLength]; - 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'}; -- cgit v1.2.3