This function is used to destroy a scene.
void dg_scene_destroy(dg_scene_t *scene);
dg_scene_destroy(scene);
void dg_scene_destroy(dg_scene_t *scene)
{
dg_array_t *tmp = 0;
if (!scene)
return;
tmp = scene->entities;
while (tmp) {
dg_entity_destroy(tmp->data);
tmp = tmp->next;
}
dg_arr_free_all(&(scene->entities));
tmp = scene->systems;
while (tmp) {
dg_system_destroy(tmp->data);
tmp = tmp->next;
}
dg_arr_free_all(&(scene->systems));
free(scene);
}