10 dbg_curscr_name = cur->name ? cur->name : "<unknown>"; \
11 dbg_curscr_name_len = strlen(dbg_curscr_name); \
12 dbg_curscr_name_pos = 320 - dbg_curscr_name_len * 9; \
15 struct screen *tunnel_screen(void);
16 struct screen *fract_screen(void);
17 struct screen *grise_screen(void);
18 struct screen *polytest_screen(void);
19 struct screen *plasma_screen(void);
20 struct screen *bump_screen(void);
21 struct screen *thunder_screen(void);
22 struct screen *metaballs_screen(void);
23 struct screen *greets_screen(void);
24 struct screen *infcubes_screen(void);
25 struct screen *hairball_screen(void);
28 static struct screen *scr[NUM_SCR];
29 static int num_screens;
31 static struct screen *cur, *prev, *next;
32 static long trans_start, trans_dur;
38 if(!(scr[idx++] = tunnel_screen())) {
41 if(!(scr[idx++] = fract_screen())) {
44 if (!(scr[idx++] = grise_screen())) {
47 if(!(scr[idx++] = polytest_screen())) {
50 if (!(scr[idx++] = plasma_screen())) {
53 if (!(scr[idx++] = bump_screen())) {
56 if (!(scr[idx++] = thunder_screen())) {
59 if(!(scr[idx++] = metaballs_screen())) {
62 if(!(scr[idx++] = greets_screen())) {
65 if(!(scr[idx++] = infcubes_screen())) {
68 if(!(scr[idx++] = hairball_screen())) {
73 assert(num_screens <= NUM_SCR);
75 for(i=0; i<num_screens; i++) {
76 if(scr[i]->init() == -1) {
83 void scr_shutdown(void)
86 for(i=0; i<num_screens; i++) {
93 if(prev) { /* we're in the middle of a transition */
94 long interval = time_msec - trans_start;
95 if(interval >= trans_dur) {
97 next->start(trans_dur);
116 void scr_keypress(int key)
118 if(cur && cur->keypress) {
123 struct screen *scr_lookup(const char *name)
126 for(i=0; i<num_screens; i++) {
127 if(strcmp(scr[i]->name, name) == 0) {
134 struct screen *scr_screen(int idx)
139 int scr_num_screens(void)
144 int scr_change(struct screen *s, long trans_time)
147 if(s == cur) return 0;
150 trans_dur = trans_time / 2; /* half for each part transition out then in */
151 trans_start = time_msec;
156 if(cur && cur->stop) {
157 cur->stop(trans_dur);