Download Tutorial C Files H Files

dg_scene_destroy

This function is used to destroy a scene.

Usage

void dg_scene_destroy(dg_scene_t *scene);

Example

dg_scene_destroy(scene);

Source code

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);
}