diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2024-06-27 21:22:50 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2024-06-27 21:22:50 -0400 |
| commit | b1d926361b9d613ad712ad161f9a8b7ccab4551d (patch) | |
| tree | 9d0b99125f4b44c4f2bf92e56fafbff461eabdfb /example | |
| parent | 89f740220cc04fc85689fce28438be46b655151c (diff) | |
checkpoint: more explicit callback system
Diffstat (limited to 'example')
| -rw-r--r-- | example/example.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/example/example.cpp b/example/example.cpp index b870806..7b82ebc 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -3,23 +3,23 @@ #include "components.hpp" -void OnEntityTypeCollision(const EntityHandle &lhs, const EntityHandle &rhs) { +void OnEntityTypeCollision(const void *lhs, const void *rhs) { fprintf(stdout, "[Example::OnEntityTypeCollision] Called\n"); } -void OnEntityCollision(const EntityHandle &lhs, const EntityHandle &rhs) { +void OnEntityCollision(const void *lhs, const void *rhs) { fprintf(stdout, "[Example::OnEntityCollision] Called\n"); } void OnInit() { - PkeArray_Add(&pkePluginCallbacks, PkeCallback { - .name = "OnEntTypeColl", - .func = reinterpret_cast<void *>(OnEntityTypeCollision), - }); - PkeArray_Add(&pkePluginCallbacks, PkeCallback { - .name = "OnEntColl", - .func = reinterpret_cast<void *>(OnEntityCollision), - }); + // create/register entity types + pkePluginInterface.PkeEntityInterfaceCount = 1; + pkePluginInterface.PkeEntityInterface = Pke_New<PkeEntityTypeInterface>(1); + + // set up entity types + auto *typeIntfs = reinterpret_cast<PkeEntityTypeInterface *>(pkePluginInterface.PkeEntityInterface); + typeIntfs[0].OnEntityTypeCollision = reinterpret_cast<CollisionDelegate>(OnEntityTypeCollision); + typeIntfs[0].OnEntityInstanceCollision = reinterpret_cast<CollisionDelegate>(OnEntityCollision); } PKEPluginInterface pkePluginInterface { |
