part system
[demo_prior] / src / part.h
1 #ifndef PART_H_
2 #define PART_H_
3
4 struct demo_part {
5         const char *name;
6         long start_time;
7         long in_time;   /* transition overlap with previous part */
8
9         int (*init)(void);
10         void (*destroy)(void);
11
12         void (*start)(void);
13         void (*stop)(void);
14
15         /* tm is the time from the start of this part in milliseconds */
16         void (*draw)(long tm);
17
18         /* optional: transition draw functions. if null, the regular draw will be
19          * called for the duration of the transition instead
20          */
21         void (*draw_in)(long tm, float t);
22         void (*draw_out)(long tm, float t);
23
24         /* optional, will be called only when active */
25         void (*reshape)(int x, int y);
26         void (*keyboard)(int key, int st);
27         void (*mbutton)(int bn, int st, int x, int y);
28         void (*mmotion)(int x, int y);
29 };
30
31 #define MAX_DEMO_PARTS  64
32 extern struct demo_part *parts[MAX_DEMO_PARTS];
33 extern int num_parts;
34
35 extern struct demo_part *cur_part, *prev_part;
36
37 void add_part(struct demo_part *part);
38 void switch_part(struct demo_part *part);
39
40 struct demo_part *find_part(const char *name);
41
42 #endif  /* PART_H_ */