#include #include // TODO: remove because our dll should not be platform dependant #undef min #undef max #include #include #include #include #include #include // Test code namespace Game { struct Door { DECLARE_ENTITY() bool IsOpened; }; DEFINE_ENTITY(Door); struct Rock { DECLARE_ENTITY() int Health; }; DEFINE_ENTITY(Rock); } // namespace Game using namespace Juliet; extern "C" __declspec(dllexport) void __cdecl GameInit() { using namespace Game; // Entity Use case InitEntityManager(); auto& manager = GetEntityManager(); Door* door = MakeEntity(manager, 10.0f, 2.0f); door->IsOpened = true; Entity* ent = door->Base; Door* stillDoor = DownCast(ent); Assert(door == stillDoor); Rock* rock = MakeEntity(manager, 1.f, 2.f); rock->Health = 100; Assert(door->Base != rock->Base); printf("Door is %s\n", door->IsOpened ? "Opened" : "Closed"); printf("Rock has %d health points\n", rock->Health); // Have to manually free for now because im not using arenas or anything free(door->Base); free(door); free(rock->Base); free(rock); } extern "C" __declspec(dllexport) void __cdecl GameShutdown() { printf("Shutting down game...\n"); } extern "C" __declspec(dllexport) void __cdecl GameUpdate(float deltaTime) { //printf("Updating game...\n"); }