diff options
-rw-r--r-- | graphics.h | 1 | ||||
-rw-r--r-- | scene.c | 12 |
2 files changed, 13 insertions, 0 deletions
@@ -187,6 +187,7 @@ struct Scene void (*addent)(Scene*, Entity*); void (*delent)(Scene*, Entity*); + Entity *(*getent)(Scene*, char*); }; /* shader params */ @@ -153,6 +153,17 @@ scene_delent(Scene *s, Entity *e) s->nents--; } +static Entity * +scene_getent(Scene *s, char *name) +{ + Entity *e; + + for(e = s->ents.next; e != &s->ents; e = e->next) + if(strcmp(e->name, name) == 0) + return e; + return nil; +} + Scene * newscene(char *name) { @@ -165,6 +176,7 @@ newscene(char *name) s->skybox = nil; s->addent = scene_addent; s->delent = scene_delent; + s->getent = scene_getent; return s; } |