summaryrefslogtreecommitdiff
path: root/example/example.cpp
blob: d9707fac3eb1cfb7048115ad633da904b3727482 (plain)
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

#include "example.hpp"

#include "pk.h"

void OnEntityTypeCollision(const void *lhs, const void *rhs) {
	(void)lhs;
	(void)rhs;
	fprintf(stdout, "[Example::OnEntityTypeCollision] Called\n");
}

void OnEntityCollision(const void *lhs, const void *rhs) {
	(void)lhs;
	(void)rhs;
	fprintf(stdout, "[Example::OnEntityCollision] Called\n");
}

void OnInit() {
	// create/register entity types
	pkePluginInterface.PkeEntityInterfaceCount = 1;
	pkePluginInterface.PkeEntityInterface = pk_new_arr<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 {
	.OnInit = OnInit,
};