world.c (637B)
1 #include <stddef.h> 2 #include "stb_ds.h" 3 #include "world.h" 4 5 World * World_Init() { 6 return NULL; 7 } 8 9 void World_Add_Entity(World *w, Entity *e) { 10 arrput(w->entities, *e); 11 } 12 13 void World_Add_System(World *w, System *s) { 14 arrput(w->systems, *s); 15 } 16 17 bool World_Run_Systems(World *w) { 18 w->turn++; 19 bool ret = false; 20 for (int i=0;i<arrlen(w->systems);++i) { 21 ret |= w->systems[i].run(w); 22 } 23 return ret; 24 } 25 26 Entity * World_Get_Entity(World *w, int id) { 27 for (int i=0;i<arrlen(w->entities);++i) { 28 if (w->entities[i].id == id) { 29 return &w->entities[i]; 30 } 31 } 32 return NULL; 33 }