aboutsummaryrefslogtreecommitdiffstats
path: root/src/animation.h
blob: 089e6e1e7f4853129721410ae92ff2941d7bec24 (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
26
27
28
29
30
#include "gameCommon.h"

#define ANIMATION_DEFAULT_DELAY 0.1

#ifndef ANIMATION_H
#define ANIMATION_H

typedef struct Animation {
    // Frame stuff.
    int frameCount;
    int currentFrame;

    // The animation is stored in a image and the texture is used for fast rendering.
    Image image;
    Texture texture;

    // Timing the frames.
    double delay;
    double lastTime;
} Animation;

Animation loadAnimationFromFile(const char* fileName);
void freeAnimation(Animation* animation);

// Set the frame and update the texture.
void setAnimationFrame(Animation * animation, int frame);

void runAnimation(Animation * animation);

#endif