diff options
author | quou <quou@disroot.org> | 2023-05-02 21:37:07 +1000 |
---|---|---|
committer | quou <quou@disroot.org> | 2023-05-02 21:37:07 +1000 |
commit | 65fa1051585f5345c3270db73ab53b7a0dbbaa50 (patch) | |
tree | 30fed63168b86f8de48698174b265ffbdfae4343 /world.c | |
parent | d3745895ca0107c705b2d89b8b80e254536dad86 (diff) |
Add ECS.
Diffstat (limited to 'world.c')
-rw-r--r-- | world.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -0,0 +1,21 @@ +#include "world.h" + +void init_world(World* world) { + world->entity_count = 0; +} + +Entity new_entity(World* world) { + Entity e; + + e = world->entity_count++; + world->bitmask[e] = 0; + return e; +} + +void add_components(World* world, Entity e, CType bits) { + world->bitmask[e] |= bits; +} + +void remove_components(World* world, Entity e, CType bits) { + world->bitmask[e] &= ~bits; +} |