mirror of
https://github.com/zoriya/Gamacon.git
synced 2026-06-01 19:26:01 +00:00
Adding helper function for the prefab
This commit is contained in:
@@ -44,6 +44,7 @@ void rend_set_anim(struct renderer *rend, const char *name);
|
||||
|
||||
void text_ctr(struct renderer *cmp, va_list args);
|
||||
void text_fdctr(gc_scene *scene, struct renderer *cmp, node *n);
|
||||
void text_safe_destroy(struct renderer *rend);
|
||||
|
||||
void map_ctr(struct renderer *cmp, va_list args);
|
||||
void map_fdctr(gc_scene *scene, struct renderer *cmp, gc_entity *entity);
|
||||
|
||||
@@ -14,3 +14,4 @@ int prefab_loadentities(node *n, gc_engine *engine, gc_scene *scene);
|
||||
gc_entity *deserialize_entity(gc_engine *engine, gc_scene *scene, node *n);
|
||||
gc_component *deserialize_component(gc_engine *engine, gc_entity *entity, \
|
||||
gc_scene *scene, node *n);
|
||||
void prefab_destroy(gc_scene *scene, int prefab_id);
|
||||
|
||||
@@ -20,6 +20,11 @@ void destroy_text_renderer(struct renderer *cmp)
|
||||
free(cmp->data);
|
||||
}
|
||||
|
||||
void text_safe_destroy(struct renderer *rend)
|
||||
{
|
||||
free(rend->data);
|
||||
}
|
||||
|
||||
int color_from_text(char *txt)
|
||||
{
|
||||
if (txt == NULL)
|
||||
|
||||
@@ -49,4 +49,12 @@ int prefab_loadentities(node *n, gc_engine *engine, gc_scene *scene)
|
||||
if (engine->on_resize && engine->get_screen_size && engine->scene)
|
||||
engine->on_resize(engine, engine->get_screen_size(engine));
|
||||
return (prefab_id - 1);
|
||||
}
|
||||
|
||||
void prefab_destroy(gc_scene *scene, int prefab_id)
|
||||
{
|
||||
for (gc_list *li = scene->entities; li; li = li->next) {
|
||||
if (((gc_entity *)li->data)->prefab_id == prefab_id)
|
||||
((gc_entity *)li->data)->destroy(li->data, scene);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user