void bobs_frame(long time) { int x = (sine[((time * 30 / 1200) + 0x40) & 0xff] * (LCD_WIDTH * 2 / 3)) >> 17; int y = (sine[((time * 37 / 1200) + 0x40) & 0xff] * (LCD_HEIGHT * 2 / 3)) >> 17; int greet_y; static int screen_num = 0; screen_num = (screen_num + 1) % SCREEN_COUNT; centre_sprite(screens[screen_num], &ball, x + LCD_WIDTH / 2, y + LCD_HEIGHT / 2); /* copy shadow screen to main screen */ memcpy(pixels, screens[screen_num], LCD_WIDTH * LCD_HEIGHT); /* overlay greetings */ if (time > PATTERN * 2) { greet_y = LCD_HEIGHT - ((time - PATTERN * 2) >> 5); put_sprite(pixels, greets_bmp, (LCD_WIDTH - greets_bmp->width) / 2, greet_y); }
void tick_words(void) { int i,j; for(i=0;i<word_count;i++) { if(words[i].clear == 1) { words[i].off_x+=(words[i].target-words[i].off_x)/5; if(abs(words[i].off_x-words[i].target)<10) words[i].delay++; if(words[i].delay >= 30) words[i].target = 300; if(words[i].off_x == 300) words[i].clear = 0; for(j = 0;j<strlen(words[i].msg);j++) { #define Y \ ((words[i].off_x+(j*16)) - (strlen(words[i].msg)*8)) put_sprite(270,Y,1,1,0,0,2,1,0x210 + (( words[i].msg[j] - 'a') * 4)); } } } }
void word(int y, char *in) { int j, i; j = strlen(in); for(i=0;i<j;i++) put_sprite((70-((j/2)*8))+(i*16),y,1,1,0,0,2,1, 0x3b0 + ((in[i] - 'a')*4)); }