void objectMoveDown(struct object *a) { lcdSetWindow(a->x, a->x, a->y, a->y + a->width - 1); lcdSetCursor(a->x, a->y); lcdPixelsDraw(a->width, BACKGROUND_COLOUR); lcdSetWindow(a->x + a->height, a->x + a->height, a->y, a->y + a->width - 1); lcdSetCursor(a->x + a->height, a->y); lcdPixelsDraw(a->width, a->red, a->green, a->blue); a->x++; }
void objectMoveLeft(struct object *a) { lcdSetWindow(a->x, a->x + a->height - 1, a->y + a->width - 1, a->y + a->width - 1); lcdSetCursor(a->x, a->y + a->width - 1); lcdPixelsDraw(a->height, BACKGROUND_COLOUR); lcdSetWindow(a->x, a->x + a->height - 1, a->y - 1, a->y - 1); lcdSetCursor(a->x, a->y - 1); lcdPixelsDraw(a->height, a->red, a->green, a->blue); a->y--; }
void lcdFillRect_FSMC(JsGraphics *gfx, short x1, short y1, short x2, short y2) { if (x1>x2) { short l=x1; x1 = x2; x2 = l; } if (y1>y2) { short l=y1; y1 = y2; y2 = l; } // offscreen if (x1>=gfx->data.width || y1>=gfx->data.height || x2<0 || y2<0) return; // now clip if (x1<0) x1=0; if (y1<0) y1=0; if (x2>=gfx->data.width) x2=gfx->data.width-1; if (y2>=gfx->data.height) y2=gfx->data.height-1; // finally! if (x1==x2) { // special case for single vertical line - no window needed lcdSetCursor(gfx,x2,y1); LCD_WR_REG(0x22); // start data tx unsigned int i=0, l=(1+y2-y1); LCD_WR_Data_multi(gfx->data.fgColor, l); } else { lcdSetWindow(gfx,x1,y1,x2,y2); lcdSetCursor(gfx,x2,y1); LCD_WR_REG(0x22); // start data tx unsigned int i=0, l=(1+x2-x1)*(1+y2-y1); LCD_WR_Data_multi(gfx->data.fgColor, l); lcdSetFullWindow(gfx); } }
void objectDraw(struct object *a, unsigned short int x, unsigned short int y) { lcdSetWindow(x, x + a->height - 1, y, y + a->width - 1); lcdSetCursor(x, y); lcdPixelsDraw(a->width * a->height, a->red, a->green, a->blue); a->x = x; a->y = y; }
/* Output a 1 bit bitmap */ void lcdBitmap1bit_FSMC(JsGraphics *gfx, short x1, short y1, unsigned short width, unsigned short height, unsigned char *data) { lcdSetWindow(gfx,x1,y1,x1+width-1,y1+height-1); lcdSetCursor(gfx,x1+width-1,y1); LCD_WR_REG(0x22); // start data tx unsigned int x,y; for(x=0;x<width;x++) { for(y=0;y<height;y++) { int bitOffset = x+(y*width); LCD_WR_Data(((data[bitOffset>>3]>>(bitOffset&7))&1) ? gfx->data.fgColor : gfx->data.bgColor); } } lcdSetFullWindow(gfx); }
void welcomeScreen(){ drawFill(drawRGB24toRGB565(nwazetYellowRed, nwazetYellowGreen, nwazetYellowBlue)); lcdSetWindow( 49, 49 + (142 - 1), 82, 82 + (156 - 1)); unsigned short imageSize = 44304; unsigned short* imagePixel = (unsigned short*) &nwazetLogo[0]; while(imageSize){ lcdWriteData(*imagePixel); imagePixel++; imageSize -= 2; } unsigned short y = 10; unsigned short spaceBetweenLines = 2; printString("Touch Display", y); y+=verdanabold14ptFontInfo.height+spaceBetweenLines; printString("By [nwazet", y); y = 295; printString("Raspberry Pi v0.1", y); }
static inline void lcdSetFullWindow(JsGraphics *gfx) { lcdSetWindow(gfx,0,0,gfx->data.width-1,gfx->data.height-1); }