8 struct screen *rtxonoff_screen(void);
11 static struct screen *scr[NUM_SCR];
12 static int num_screens;
14 static struct screen *cur, *prev, *next;
15 static long trans_start, trans_dur;
21 if(!(scr[idx++] = rtxonoff_screen())) {
26 assert(num_screens <= NUM_SCR);
28 for(i=0; i<num_screens; i++) {
29 if(scr[i]->init() == -1) {
36 void scr_shutdown(void)
39 for(i=0; i<num_screens; i++) {
46 if(prev) { /* we're in the middle of a transition */
47 long interval = time_msec - trans_start;
48 if(interval >= trans_dur) {
50 next->start(trans_dur);
64 void scr_keypress(int key)
66 if(cur && cur->keypress) {
71 struct screen *scr_lookup(const char *name)
74 for(i=0; i<num_screens; i++) {
75 if(strcmp(scr[i]->name, name) == 0) {
82 struct screen *scr_screen(int idx)
87 int scr_num_screens(void)
92 int scr_change(struct screen *s, long trans_time)
95 if(s == cur) return 0;
98 trans_dur = trans_time / 2; /* half for each part transition out then in */
99 trans_start = time_msec;
104 if(cur && cur->stop) {
105 cur->stop(trans_dur);