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;
46 if(!(scr[idx++] = tunnel_screen())) {
49 if(!(scr[idx++] = fract_screen())) {
52 if (!(scr[idx++] = grise_screen())) {
55 if(!(scr[idx++] = polytest_screen())) {
58 if (!(scr[idx++] = plasma_screen())) {
61 if (!(scr[idx++] = bump_screen())) {
64 if (!(scr[idx++] = thunder_screen())) {
67 if(!(scr[idx++] = metaballs_screen())) {
70 if(!(scr[idx++] = greets_screen())) {
73 if(!(scr[idx++] = infcubes_screen())) {
76 if(!(scr[idx++] = hairball_screen())) {
81 assert(num_screens <= NUM_SCR);
83 for(i=0; i<num_screens; i++) {
84 loadscr(i, num_screens);
85 if(scr[i]->init() == -1) {
94 void scr_shutdown(void)
97 for(i=0; i<num_screens; i++) {
102 void scr_update(void)
104 if(prev) { /* we're in the middle of a transition */
105 long interval = time_msec - trans_start;
106 if(interval >= trans_dur) {
108 next->start(trans_dur);
127 void scr_keypress(int key)
129 if(cur && cur->keypress) {
134 struct screen *scr_lookup(const char *name)
137 for(i=0; i<num_screens; i++) {
138 if(strcmp(scr[i]->name, name) == 0) {
145 struct screen *scr_screen(int idx)
150 int scr_num_screens(void)
155 int scr_change(struct screen *s, long trans_time)
158 if(s == cur) return 0;
161 trans_dur = trans_time / 2; /* half for each part transition out then in */
162 trans_start = time_msec;
167 if(cur && cur->stop) {
168 cur->stop(trans_dur);
185 extern uint16_t loading_pixels[];
187 void start_loadscr(void)
189 swap_buffers(loading_pixels);
196 #define FING_LAST_X 291
201 void end_loadscr(void)
203 blitfb(loading_pixels + SPLAT_Y * 320 + SPLAT_X, loading_pixels + 320 * 240, 32, 72, 32);
204 blitfb_key(loading_pixels + FING_Y * 320 + FING_LAST_X, loading_pixels + 247 * 320 + 64,
205 FING_W, FING_H, FING_W, 0);
206 swap_buffers(loading_pixels);
210 void loadscr(int n, int count)
212 int xoffs = 75 * n / (count - 1);
213 static int prev_xoffs;
214 uint16_t *sptr, *dptr;
216 sptr = loading_pixels + 247 * 320 + 64;
217 dptr = loading_pixels + FING_Y * 320 + FING_X + prev_xoffs;
219 while(prev_xoffs < xoffs) {
220 blitfb_key(dptr, sptr, FING_W, FING_H, FING_W, 0);
225 swap_buffers(loading_pixels);