Download Tutorial C Files H Files

dg_animator_set_animation

This function is used to change the used animation with the animator.

Usage

void dg_animator_set_animation(dg_animator_t *animator, char *key);

Example

dg_animator_set_animation(animator, "walk");

Source code

void dg_animator_set_animation(dg_animator_t *animator, char *key)
{
    int index = 0;

    for (int i = 0; i < animator->length; i++) {
        if (!dg_strcmp(animator->keys[i], key))
            index = i;
    }
    animator->current = index;
}