blob: e6c717a966c9af3c00447e9257cde7372c553ef9 (
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
30
31
32
33
34
35
36
37
38
|
#ifndef ANIMATION_H_
#define ANIMATION_H_
#include <SDL2/SDL.h>
#include <stdbool.h>
#include "demo.h"
struct animation_init {
SDL_Renderer* ren;
const char* spritesheet;
int initial_frame_count;
float initial_angle;
float* initial_frame_times;
SDL_Rect* initial_frames;
};
struct animation {
SDL_Texture* texture;
int num_frames;
float angle;
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);
void draw_animation(struct demo* demo,
const struct animation* animation,
const SDL_Rect* d_rect);
#endif // ANIMATION_H_
|