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);
18 static struct screen *scr[NUM_SCR];
19 static int num_screens;
21 static struct screen *cur, *prev, *next;
22 static long trans_start, trans_dur;
28 if(!(scr[idx++] = tunnel_screen())) {
31 if(!(scr[idx++] = fract_screen())) {
34 if (!(scr[idx++] = grise_screen())) {
37 if(!(scr[idx++] = polytest_screen())) {
40 if (!(scr[idx++] = plasma_screen())) {
43 if (!(scr[idx++] = bump_screen())) {
46 if (!(scr[idx++] = thunder_screen())) {
49 if(!(scr[idx++] = metaballs_screen())) {
54 assert(num_screens <= NUM_SCR);
56 for(i=0; i<num_screens; i++) {
57 if(scr[i]->init() == -1) {
64 void scr_shutdown(void)
67 for(i=0; i<num_screens; i++) {
74 if(prev) { /* we're in the middle of a transition */
75 long interval = time_msec - trans_start;
76 if(interval >= trans_dur) {
78 next->start(trans_dur);
92 struct screen *scr_lookup(const char *name)
95 for(i=0; i<num_screens; i++) {
96 if(strcmp(scr[i]->name, name) == 0) {
103 struct screen *scr_screen(int idx)
108 int scr_num_screens(void)
113 int scr_change(struct screen *s, long trans_time)
116 if(s == cur) return 0;
119 trans_dur = trans_time / 2; /* half for each part transition out then in */
120 trans_start = time_msec;
125 if(cur && cur->stop) {
126 cur->stop(trans_dur);