This function is used to add a frame in the animation.
void dg_animation_add(dg_animation_t *animation, int i)
animation_add(animation, 2);
void dg_animation_add(dg_animation_t *animation, int i)
{
int *new_list = 0;
if (!(animation->frames)) {
animation->frames = malloc(sizeof(int));
animation->frames[0] = i;
animation->size = 1;
} else {
new_list = malloc(sizeof(int) * (animation->size + 1));
for (int i = 0; i < animation->size; i++)
new_list[i] = animation->frames[i];
new_list[animation->size] = i;
animation->size++;
free(animation->frames);
animation->frames = new_list;
}
}