aboutsummaryrefslogtreecommitdiff
path: root/world.h
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2023-05-02 21:37:07 +1000
committerquou <quou@disroot.org>2023-05-02 21:37:07 +1000
commit65fa1051585f5345c3270db73ab53b7a0dbbaa50 (patch)
tree30fed63168b86f8de48698174b265ffbdfae4343 /world.h
parentd3745895ca0107c705b2d89b8b80e254536dad86 (diff)
Add ECS.
Diffstat (limited to 'world.h')
-rw-r--r--world.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/world.h b/world.h
new file mode 100644
index 0000000..7f19520
--- /dev/null
+++ b/world.h
@@ -0,0 +1,24 @@
+#ifndef world_h
+#define world_h
+
+#include "components.h"
+
+#define max_entities 256
+
+typedef int Entity;
+
+typedef struct {
+ int entity_count;
+
+ unsigned char bitmask[max_entities];
+
+ CSprite sprites[max_entities];
+ CPosition positions[max_entities];
+} World;
+
+void init_world(World* world);
+Entity new_entity(World* world);
+void add_components(World* world, Entity e, CType bits);
+void remove_components(World* world, Entity e, CType bits);
+
+#endif