blob: f1734016763dd89725ac2c729056bd78b26d1426 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "animation.h"
#include "game.h"
#include <raylib.h>
Animation loadAnimationFromFile(const char* fileName)
{
Animation animation;
// Load image in.
animation.image = LoadImageAnim(fileName, &animation.frameCount);
animation.texture = LoadTextureFromImage(animation.image);
// Set options.
animation.currentFrame = 0;
animation.delay = ANIMATION_DEFAULT_DELAY;
animation.lastTime = -1.0; // -1.0 means there wasn't a last time.
return animation;
}
void freeAnimation(Animation* animation)
{
UnloadImage(animation->image);
UnloadTexture(animation->texture);
}
|