From 65fa1051585f5345c3270db73ab53b7a0dbbaa50 Mon Sep 17 00:00:00 2001 From: quou Date: Tue, 2 May 2023 21:37:07 +1000 Subject: Add ECS. --- world.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 world.c (limited to 'world.c') diff --git a/world.c b/world.c new file mode 100644 index 0000000..b271c3d --- /dev/null +++ b/world.c @@ -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; +} -- cgit v1.2.3-54-g00ecf