8 struct screen *example_screen(void);
10 struct screen *another_screen(void);
11 struct screen *athird_screen(void);
15 static struct screen *scr[NUM_SCR];
16 static int num_screens;
18 static struct screen *cur, *prev, *next;
19 static long trans_start, trans_dur;
25 if(!(scr[idx++] = example_screen())) {
29 if(!(scr[idx++] = another_screen())) {
32 if(!(scr[idx++] = athird_screen())) {
38 assert(num_screens <= NUM_SCR);
40 for(i=0; i<num_screens; i++) {
41 if(scr[i]->init() == -1) {
48 void scr_shutdown(void)
51 for(i=0; i<num_screens; i++) {
58 if(prev) { /* we're in the middle of a transition */
59 long interval = time_msec - trans_start;
60 if(interval >= trans_dur) {
62 next->start(trans_dur);
76 void scr_keypress(int key)
78 if(cur && cur->keypress) {
83 struct screen *scr_lookup(const char *name)
86 for(i=0; i<num_screens; i++) {
87 if(strcmp(scr[i]->name, name) == 0) {
94 struct screen *scr_screen(int idx)
99 int scr_num_screens(void)
104 int scr_change(struct screen *s, long trans_time)
107 if(s == cur) return 0;
110 trans_dur = trans_time / 2; /* half for each part transition out then in */
111 trans_start = time_msec;
116 if(cur && cur->stop) {
117 cur->stop(trans_dur);