12 dbg_curscr_name = cur->name ? cur->name : "<unknown>"; \
13 dbg_curscr_name_len = strlen(dbg_curscr_name); \
14 dbg_curscr_name_pos = 320 - dbg_curscr_name_len * 9; \
17 struct screen *tunnel_screen(void);
18 struct screen *fract_screen(void);
19 struct screen *grise_screen(void);
20 struct screen *polytest_screen(void);
21 struct screen *plasma_screen(void);
22 struct screen *bump_screen(void);
23 struct screen *thunder_screen(void);
24 struct screen *metaballs_screen(void);
25 struct screen *greets_screen(void);
26 struct screen *infcubes_screen(void);
27 struct screen *hairball_screen(void);
29 void start_loadscr(void);
30 void end_loadscr(void);
31 void loadscr(int n, int count);
34 static struct screen *scr[NUM_SCR];
35 static int num_screens;
37 static struct screen *cur, *prev, *next;
38 static long trans_start, trans_dur;
40 const char *dbg_curscr_name;
41 int dbg_curscr_name_len, dbg_curscr_name_pos;
49 if(!(scr[idx++] = tunnel_screen())) {
52 if(!(scr[idx++] = fract_screen())) {
55 if (!(scr[idx++] = grise_screen())) {
58 if(!(scr[idx++] = polytest_screen())) {
61 if (!(scr[idx++] = plasma_screen())) {
64 if (!(scr[idx++] = bump_screen())) {
67 if (!(scr[idx++] = thunder_screen())) {
70 if(!(scr[idx++] = metaballs_screen())) {
73 if(!(scr[idx++] = greets_screen())) {
76 if(!(scr[idx++] = infcubes_screen())) {
79 if(!(scr[idx++] = hairball_screen())) {
84 assert(num_screens <= NUM_SCR);
86 for(i=0; i<num_screens; i++) {
87 loadscr(i, num_screens);
88 if(scr[i]->init() == -1) {
97 void scr_shutdown(void)
100 for(i=0; i<num_screens; i++) {
105 void scr_update(void)
107 if(prev) { /* we're in the middle of a transition */
108 long interval = time_msec - trans_start;
109 if(interval >= trans_dur) {
111 next->start(trans_dur);
130 void scr_keypress(int key)
132 if(cur && cur->keypress) {
137 struct screen *scr_lookup(const char *name)
140 for(i=0; i<num_screens; i++) {
141 if(strcmp(scr[i]->name, name) == 0) {
148 struct screen *scr_screen(int idx)
153 int scr_num_screens(void)
158 int scr_change(struct screen *s, long trans_time)
161 if(s == cur) return 0;
164 trans_dur = trans_time / 2; /* half for each part transition out then in */
165 trans_start = time_msec;
170 if(cur && cur->stop) {
171 cur->stop(trans_dur);
188 extern uint16_t loading_pixels[];
190 void start_loadscr(void)
192 swap_buffers(loading_pixels);
199 #define FING_LAST_X 291
204 void end_loadscr(void)
206 blitfb(loading_pixels + SPLAT_Y * 320 + SPLAT_X, loading_pixels + 320 * 240, 32, 72, 32);
207 blit_key(loading_pixels + FING_Y * 320 + FING_LAST_X, 320, loading_pixels + 247 * 320 + 64,
208 FING_W, FING_H, FING_W, 0);
209 swap_buffers(loading_pixels);
213 void loadscr(int n, int count)
215 int xoffs = 75 * n / (count - 1);
216 static int prev_xoffs;
217 uint16_t *sptr, *dptr;
219 sptr = loading_pixels + 247 * 320 + 64;
220 dptr = loading_pixels + FING_Y * 320 + FING_X + prev_xoffs;
222 while(prev_xoffs < xoffs) {
223 blit_key(dptr, 320, sptr, FING_W, FING_H, FING_W, 0);
228 swap_buffers(loading_pixels);