Download Tutorial C Files H Files

dg_animation_create

This function is used to initialize the animation.

Usage

dg_animation_t *dg_animation_create(dg_spritesheet_t *sheet, float speed);

Example

dg_animation_t *animation = dg_animation_create(sheet, 2);

Source code

dg_animation_t *dg_animation_create(dg_spritesheet_t *sheet, float speed)
{
    dg_animation_t *animation = malloc(sizeof(dg_animation_t));

    if (!animation)
        return 0;
    animation->sheet = sheet;
    animation->speed = speed;
    animation->frames = 0;
    animation->size = 0;
    return animation;
}