working on the demosystem, added libtreestore
[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         int (*init)(void);
10         void (*destroy)(void);
11         void (*reshape)(int x, int y);
12
13         void (*start)(void);
14         void (*stop)(void);
15
16         void (*update)(long tmsec);
17         void (*draw)(void);
18
19         void (*keyboard)(int key, int pressed);
20         void (*mouse)(int bn, int pressed, int x, int y);
21         void (*motion)(int x, int y);
22
23         struct anm_track track;
24         int active, prio;
25         float vis;
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[MAX_DSYS_SCREENS];
37 int dsys_num_act;
38
39
40 int dsys_init(const char *fname);
41 void dsys_destroy(void);
42
43 void dsys_update(void);
44 void dsys_draw(void);
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 /* overrides the demo sequence, and runs a single screen */
53 struct demoscreen *dsys_find_screen(const char *name);
54 void dsys_run_screen(struct demoscreen *scr);
55
56 int dsys_add_screen(struct demoscreen *scr);
57
58 #endif  /* DEMOSYS_H_ */