updated readme
[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         long start_time;
25         int prio;
26         float vis;
27 };
28
29 struct demoevent {
30         char *name;
31         struct anm_track track;
32         float value;
33         struct demoscreen *scr;
34 };
35
36 #define MAX_DSYS_SCREENS        64
37 struct demosystem {
38         int running;                    /* run/stop state */
39         int eof;                                /* end of demo flag, seek back to reset */
40         long tmsec;
41
42         struct demoscreen *screens[MAX_DSYS_SCREENS];
43         int num_screens;
44         struct demoscreen *act[MAX_DSYS_SCREENS];
45         int num_act;
46
47         struct demoscreen *scr_override;
48
49         void *trackmap;
50         struct demoevent *ev;
51         int num_ev;
52 };
53
54 struct demosystem dsys;
55
56
57 int dsys_init(const char *fname);
58 void dsys_destroy(void);
59
60 void dsys_update(void);
61 void dsys_draw(void);
62
63 void dsys_run(void);
64 void dsys_stop(void);
65 void dsys_seek_abs(long tm);
66 void dsys_seek_rel(long dt);
67 void dsys_seek_norm(float t);
68
69 /* overrides the demo sequence, and runs a single screen */
70 struct demoscreen *dsys_find_screen(const char *name);
71 void dsys_run_screen(struct demoscreen *scr);
72
73 int dsys_add_screen(struct demoscreen *scr);
74
75 /* demo event tracks */
76 int dsys_add_event(const char *name);
77 int dsys_find_event(const char *name);
78 float dsys_value(const char *name);
79
80 #endif  /* DEMOSYS_H_ */