summaryrefslogtreecommitdiff
path: root/Week1-Pacman/src/animation.h
blob: 795b6c7462c84e42c094f9d0a4bf5299689e9d30 (plain)
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
#ifndef ANIMATION_H_
#define ANIMATION_H_

#include <SDL2/SDL_rect.h>
#include <stdbool.h>

struct animation_init {
  int initial_frame_count;

  float* initial_frame_times;
  SDL_Rect* initial_frames;
};

struct animation {
  int num_frames;

  int current_frame;
  float current_time;

  float* frame_times;
  SDL_Rect* frames;
};

void init_animation(struct animation* animation,
                    struct animation_init* init);
void update_animation(struct animation* animation, float dt);
void free_animation(struct animation* animation);

#endif // ANIMATION_H_