static void chopDrawScene() { char s[30]; GrClearWindow (chopBuffer, GR_FALSE); sprintf (s, "Chopper - %d", chopCounter); pz_draw_header (s); GrSetGCForeground(chopGC, GR_RGB(WHITE)); GrFillRect(chopBuffer, chopGC, 0,0,screen_info.cols,screen_info.rows ); chopDrawPlayer(iPlayerPosX - iCameraPosX,iPlayerPosY); /* If I was less lazy I could make a nifty shadow effect with this stuff... int h = chopTerrainHeightAtPoint(&mGround, iPlayerPosX); GrSetGCForeground(gc, GR_RGB(BLACK)); GrFillRect(chopBuffer,gc,iPlayerPosX - iCameraPosX,h - 1,2,2); */ chopDrawTheWorld(); //Flip the buffer GrCopyArea(chopWindow, chopGC, 0, 0, screen_info.cols, (screen_info.rows - (HEADER_TOPLINE + 1)), chopBuffer, 0, 0, MWROP_SRCCOPY); }
static void chopDrawScene(void) { char s[30]; int w; #if LCD_DEPTH > 2 rb->lcd_set_background(LCD_BLACK); #elif LCD_DEPTH == 2 rb->lcd_set_background(LCD_WHITE); #endif rb->lcd_clear_display(); chopDrawTheWorld(); chopDrawPlayer(iPlayerPosX - iCameraPosX, iPlayerPosY); score = -20 + iPlayerPosX/3; #if LCD_DEPTH == 1 rb->lcd_set_drawmode(DRMODE_COMPLEMENT); #else rb->lcd_set_drawmode(DRMODE_FG); #endif #if LCD_DEPTH > 2 rb->lcd_set_foreground(LCD_BLACK); #elif LCD_DEPTH == 2 rb->lcd_set_foreground(LCD_WHITE); #endif #if LCD_WIDTH <= 128 rb->snprintf(s, sizeof(s), "Dist: %d", score); #else rb->snprintf(s, sizeof(s), "Distance: %d", score); #endif rb->lcd_getstringsize(s, &w, NULL); rb->lcd_putsxy(2, 2, s); if (score < highscore) { int w2; #if LCD_WIDTH <= 128 rb->snprintf(s, sizeof(s), "Hi: %d", highscore); #else rb->snprintf(s, sizeof(s), "Best: %d", highscore); #endif rb->lcd_getstringsize(s, &w2, NULL); if (LCD_WIDTH - 2 - w2 > w + 2) rb->lcd_putsxy(LCD_WIDTH - 2 - w2, 2, s); } rb->lcd_set_drawmode(DRMODE_SOLID); rb->lcd_update(); }