uint8_t printChar_lcd(sFont *font, uint32_t x, uint32_t y, uint16_t color_fg, uint16_t color_bg, uint8_t c) { uint8_t index = c-font->start; uint8_t width = font->widthTable[index]; uint8_t *data = &font->dataTable[font->offsetTable[index]]; register uint32_t x_t, y_t=y; register uint8_t mask = 0x80; for(; y_t<y+font->height; y_t++) { for(x_t=x; x_t< x+width; x_t++, mask>>=1) { if(mask <= 0) { mask = 0x80; data++; } if(*data & mask) { DrawPixel32(color_fg, x_t, y_t); } else { DrawPixel32(color_bg, x_t, y_t); } } } return width; }
void DrawVLine32(uint16_t color, uint32_t x, uint32_t y1, uint32_t y2) { for(; y1<y2; y1++) { DrawPixel32(color, x, y1); } }
void DrawHLine32(uint16_t color, uint32_t x1, uint32_t x2, uint32_t y) { for(; x1<x2; x1++) { DrawPixel32(color, x1, y); } }
void DrawVLineClipped(uint16_t Color, uint32_t H, uint32_t V1, uint32_t V2) { register uint32_t i = 0; uint32_t End = V2*HLEN + H; for (i = V1*HLEN+H; i <= End; i+= HLEN, V1++) { if(clippingRect != NULL && H >= clippingRect->x && H <= clippingRect->x+clippingRect->width && V1 >= clippingRect->y && V1 <= clippingRect->y+clippingRect->height) continue; DrawPixel32(Color, H, V1); } }
void ClearVLineClipped(uint16_t Color, uint32_t H, uint32_t V1, uint32_t V2) { register uint32_t i = 0; uint32_t End = V2*HLEN + H; for (i = V1*HLEN+H; i <= End; i+= HLEN, V1++) { if(clippingRect != NULL && H >= clippingRect->x && H <= clippingRect->x+clippingRect->width && V1 >= clippingRect->y && V1 <= clippingRect->y+clippingRect->height) continue; uint32_t grid = (gridbuffer[V1][H/32]); uint32_t mask = (1<<(31-(H%32))); if(grid & mask) { DrawPixel32(GRIDCOLOR, H, V1); } else { DrawPixel32(Color, H, V1); } } }
//--------------------------------------------------------------- // Name: DrawStars() // Desc: Draws the stars to the screen //--------------------------------------------------------------- int DrawStars(const PARTICLE *stars, int nTotalAmountofStars) { //----Do pixel animation here---- //Lock the surface for drawing if(!Lock(lpddsSecondary)) return(0); for(int i=0; i<nTotalAmountofStars; i++) DrawPixel32(ddsd,(int)stars[i].x,(int)stars[i].y, stars[i].r,stars[i].g,stars[i].b); //Unlock the surface if(!UnLock(lpddsSecondary)) return(0); //----End do pixel animation here---- return 1; }