diff options
author | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-07 23:10:23 -0600 |
---|---|---|
committer | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-07 23:10:23 -0600 |
commit | e5268813dcbdc0d90a081b2223ebc21749038635 (patch) | |
tree | 7c917996749e4123fb1fe49ddd1ed3b8f7e92334 /src/world.h | |
parent | a90e1987de75cfecc2693952625af8cce507ae95 (diff) |
Better world
Diffstat (limited to 'src/world.h')
-rw-r--r-- | src/world.h | 31 |
1 files changed, 31 insertions, 0 deletions
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 |