From fa7fc343a0e444da72938fad58d219cf52228976 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Thu, 21 Dec 2023 17:44:03 -0500 Subject: plugin checkpoint - multiple plugins and collision callbacks --- example/example.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 example/example.cpp (limited to 'example/example.cpp') diff --git a/example/example.cpp b/example/example.cpp new file mode 100644 index 0000000..b870806 --- /dev/null +++ b/example/example.cpp @@ -0,0 +1,27 @@ + +#include "example.hpp" + +#include "components.hpp" + +void OnEntityTypeCollision(const EntityHandle &lhs, const EntityHandle &rhs) { + fprintf(stdout, "[Example::OnEntityTypeCollision] Called\n"); +} + +void OnEntityCollision(const EntityHandle &lhs, const EntityHandle &rhs) { + fprintf(stdout, "[Example::OnEntityCollision] Called\n"); +} + +void OnInit() { + PkeArray_Add(&pkePluginCallbacks, PkeCallback { + .name = "OnEntTypeColl", + .func = reinterpret_cast(OnEntityTypeCollision), + }); + PkeArray_Add(&pkePluginCallbacks, PkeCallback { + .name = "OnEntColl", + .func = reinterpret_cast(OnEntityCollision), + }); +} + +PKEPluginInterface pkePluginInterface { + .OnInit = OnInit, +}; -- cgit v1.2.3