demosys
[andemo] / src / demosys.h
1 #ifndef DEMOSYS_H_
2 #define DEMOSYS_H_
3
4 #include "anim/track.h"
5
6 struct demoscreen {
7         char *name;
8
9         struct anm_track track;
10
11         int (*init)(void);
12         void (*destroy)(void);
13         void (*reshape)(int x, int y);
14
15         void (*start)(void);
16         void (*stop)(void);
17
18         void (*update)(long tmsec);
19         void (*draw)(void);
20
21         void (*keyboard)(int key, int pressed);
22         void (*mouse)(int bn, int pressed, int x, int y);
23         void (*motion)(int x, int y);
24
25         struct demoscreen *next;
26 };
27
28 /* global demo state */
29 int dsys_running;       /* run/stop state */
30 int dsys_eof;           /* end of demo flag, seek back to reset */
31 long dsys_time;         /* demo time in milliseconds */
32
33 #define MAX_DSYS_SCREENS        64
34 struct demoscreen *dsys_screens[MAX_DSYS_SCREENS];
35 int dsys_num_screens;
36 struct demoscreen *dsys_act_scr;        /* linked list of active screens */
37
38
39 int dsys_init(const char *fname);
40 void dsys_destroy(void);
41
42 /* overrides the demo sequence, and runs a single screen */
43 struct demoscreen *dsys_find_screen(const char *name);
44 void dsys_run_screen(struct demoscreen *scr);
45
46 void dsys_run(void);
47 void dsys_stop(void);
48 void dsys_seek_abs(long tm);
49 void dsys_seek_rel(long dt);
50 void dsys_seek_norm(float t);
51
52 int dsys_add_screen(struct demoscreen *scr);
53
54 #endif  /* DEMOSYS_H_ */