8 struct screen *tunnel_screen(void);
9 struct screen *fract_screen(void);
10 struct screen *grise_screen(void);
11 struct screen *polytest_screen(void);
12 struct screen *plasma_screen(void);
13 struct screen *bump_screen(void);
14 struct screen *thunder_screen(void);
15 struct screen *metaballs_screen(void);
16 struct screen *greets_screen(void);
17 struct screen *infcubes_screen(void);
20 static struct screen *scr[NUM_SCR];
21 static int num_screens;
23 static struct screen *cur, *prev, *next;
24 static long trans_start, trans_dur;
30 if(!(scr[idx++] = tunnel_screen())) {
33 if(!(scr[idx++] = fract_screen())) {
36 if (!(scr[idx++] = grise_screen())) {
39 if(!(scr[idx++] = polytest_screen())) {
42 if (!(scr[idx++] = plasma_screen())) {
45 if (!(scr[idx++] = bump_screen())) {
48 if (!(scr[idx++] = thunder_screen())) {
51 if(!(scr[idx++] = metaballs_screen())) {
54 if(!(scr[idx++] = greets_screen())) {
57 if(!(scr[idx++] = infcubes_screen())) {
62 assert(num_screens <= NUM_SCR);
64 for(i=0; i<num_screens; i++) {
65 if(scr[i]->init() == -1) {
72 void scr_shutdown(void)
75 for(i=0; i<num_screens; i++) {
82 if(prev) { /* we're in the middle of a transition */
83 long interval = time_msec - trans_start;
84 if(interval >= trans_dur) {
86 next->start(trans_dur);
100 void scr_keypress(int key)
102 if(cur && cur->keypress) {
107 struct screen *scr_lookup(const char *name)
110 for(i=0; i<num_screens; i++) {
111 if(strcmp(scr[i]->name, name) == 0) {
118 struct screen *scr_screen(int idx)
123 int scr_num_screens(void)
128 int scr_change(struct screen *s, long trans_time)
131 if(s == cur) return 0;
134 trans_dur = trans_time / 2; /* half for each part transition out then in */
135 trans_start = time_msec;
140 if(cur && cur->stop) {
141 cur->stop(trans_dur);