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);
18 struct screen *hairball_screen(void);
21 static struct screen *scr[NUM_SCR];
22 static int num_screens;
24 static struct screen *cur, *prev, *next;
25 static long trans_start, trans_dur;
31 if(!(scr[idx++] = tunnel_screen())) {
34 if(!(scr[idx++] = fract_screen())) {
37 if (!(scr[idx++] = grise_screen())) {
40 if(!(scr[idx++] = polytest_screen())) {
43 if (!(scr[idx++] = plasma_screen())) {
46 if (!(scr[idx++] = bump_screen())) {
49 if (!(scr[idx++] = thunder_screen())) {
52 if(!(scr[idx++] = metaballs_screen())) {
55 if(!(scr[idx++] = greets_screen())) {
58 if(!(scr[idx++] = infcubes_screen())) {
61 if(!(scr[idx++] = hairball_screen())) {
66 assert(num_screens <= NUM_SCR);
68 for(i=0; i<num_screens; i++) {
69 if(scr[i]->init() == -1) {
76 void scr_shutdown(void)
79 for(i=0; i<num_screens; i++) {
86 if(prev) { /* we're in the middle of a transition */
87 long interval = time_msec - trans_start;
88 if(interval >= trans_dur) {
90 next->start(trans_dur);
104 void scr_keypress(int key)
106 if(cur && cur->keypress) {
111 struct screen *scr_lookup(const char *name)
114 for(i=0; i<num_screens; i++) {
115 if(strcmp(scr[i]->name, name) == 0) {
122 struct screen *scr_screen(int idx)
127 int scr_num_screens(void)
132 int scr_change(struct screen *s, long trans_time)
135 if(s == cur) return 0;
138 trans_dur = trans_time / 2; /* half for each part transition out then in */
139 trans_start = time_msec;
144 if(cur && cur->stop) {
145 cur->stop(trans_dur);