X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=demo_prior;a=blobdiff_plain;f=src%2Fpart.h;fp=src%2Fpart.h;h=8d0fbdfafce9902488187f31e86ffcfbd5e216d5;hp=0000000000000000000000000000000000000000;hb=6a752049e496c93a61e0130348f71888583d743c;hpb=646e75fcb6bdb93c853f6706c23d809c2c63415c diff --git a/src/part.h b/src/part.h new file mode 100644 index 0000000..8d0fbdf --- /dev/null +++ b/src/part.h @@ -0,0 +1,42 @@ +#ifndef PART_H_ +#define PART_H_ + +struct demo_part { + const char *name; + long start_time; + long in_time; /* transition overlap with previous part */ + + int (*init)(void); + void (*destroy)(void); + + void (*start)(void); + void (*stop)(void); + + /* tm is the time from the start of this part in milliseconds */ + void (*draw)(long tm); + + /* optional: transition draw functions. if null, the regular draw will be + * called for the duration of the transition instead + */ + void (*draw_in)(long tm, float t); + void (*draw_out)(long tm, float t); + + /* optional, will be called only when active */ + void (*reshape)(int x, int y); + void (*keyboard)(int key, int st); + void (*mbutton)(int bn, int st, int x, int y); + void (*mmotion)(int x, int y); +}; + +#define MAX_DEMO_PARTS 64 +extern struct demo_part *parts[MAX_DEMO_PARTS]; +extern int num_parts; + +extern struct demo_part *cur_part, *prev_part; + +void add_part(struct demo_part *part); +void switch_part(struct demo_part *part); + +struct demo_part *find_part(const char *name); + +#endif /* PART_H_ */