blob: 6f051e3e630a0fe148cec5808a638d42eb1f784e (
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
39
40
41
42
43
44
45
46
47
48
49
|
#ifndef IMV_SOURCE_H
#define IMV_SOURCE_H
#include <stdbool.h>
#include "bitmap.h"
/* Generic source of one or more bitmaps. Essentially a single image file */
struct imv_source {
/* usually the path of the image this is the source of */
char *name;
/* source's image dimensions */
int width;
int height;
/* Usually 1, more if animated */
int num_frames;
/* Frames are returned using SDL events. These two fields must be
* populated by callers before calling any frame loading functionality
* on the source.
*/
unsigned int image_event_id;
unsigned int error_event_id;
/* Trigger loading of the first frame. */
void (*load_first_frame)(struct imv_source *src);
/* Trigger loading of next frame. */
void (*load_next_frame)(struct imv_source *src);
/* Notify source of time passing, automatically triggers loading of
* the next frame when due. */
void (*time_passed)(struct imv_source *src, double dt);
/* Asks the source how long we can sleep for before the next frame is due */
double (*time_left)(struct imv_source *src);
/* Safely free contents of this source. After this returns
* it is safe to dealocate/overwrite the imv_source instance.
*/
void (*free)(struct imv_source *src);
/* Implementation private data */
void *private;
};
#endif
|