From e5268813dcbdc0d90a081b2223ebc21749038635 Mon Sep 17 00:00:00 2001 From: nathansmithsmith Date: Fri, 7 Jul 2023 23:10:23 -0600 Subject: Better world --- src/world.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/world.h') diff --git a/src/world.h b/src/world.h index 379b920..b075301 100644 --- a/src/world.h +++ b/src/world.h @@ -4,4 +4,35 @@ #ifndef WORLD_H #define WORLD_H +#define FINGERPRINT_START_RANGE_MIN 0xf +#define FINGERPRINT_START_RANGE_MAX 0xff + +typedef struct World { + Entity * entities; + size_t entitiesCount; + + // For getting entity id; + EntityId * lookUp; + size_t lookUpSize; + + EntityId * vacantIds; + size_t vacantIdsCount; + + // Used for making fingerprints for entities. + EntityFingerprint currentFingerprint; +} World; + +void initWorld(World * world); +void freeWorld(World * world); + +#define ENTITY_ID_NONE -1 + +// ENTITY_ID_NONE on error. +Entity * getEntityFromWorld(World world, EntityId id); +EntityId addEntityToWorld(World * world, Entity entity); +KfError removeEntityFromWorld(World * world, EntityId id); + +void updateWorld(World * world, Game * game); +void drawWorld(World * world, Game * game); + #endif -- cgit v1.2.3