pong game added to the main sketch
Dependencies: RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor
Fork of MainSketch by
Diff: render.h
- Revision:
- 11:1da15361a35b
- Parent:
- 10:9d9b3b9b28b8
--- a/render.h Wed May 24 11:21:37 2017 +0000 +++ b/render.h Wed May 24 13:27:07 2017 +0000 @@ -21,21 +21,35 @@ TFT.rect(0, 150, 50, 200, White); TFT.rect(0, 200, 50, 250, White); } -void whiteboard(){ +void draw_clockface(int x0, int y0, int r, int markerlength, int color) +{ + TFT.circle(x0, y0, r, White); + //for ( int n = 0; n < 13; n++) { + // int x1, y1, x2, y2= 0; + // double angle = n * 2 * M_PI / 12; + // x2 = r * cos(angle) + x0; + // y2 = r * sin(angle) + y0; + // x1 = (r - markerlength) * cos(angle) + x0; + // y2 = (r - markerlength) * sin(angle) + y0; + // TFT.line(x1, y1, x2, y2, color); + //} +} +void whiteboard() +{ int color = 0; int xpos = 0,ypos = 0,xp = 0,yp = 0,sw = 0;; drawbuttons(); bool running = true; while(running) { - + xp = readX(); yp = readY(); // top chunk of the screen is the button area // // 0<y<50 is palette area // //pc.printf("xpos=%d\t,\typo=%d",xpos,ypos); - // xp=(240*(xpos-5800))/51200; - // yp=320-(320*(ypos-3000))/58300; + // xp=(240*(xpos-5800))/51200; + // yp=320-(320*(ypos-3000))/58300; if(touching == 1) pc.printf("\txp=%d\t,\typo=%d\n\r", xp, yp); if(xp > 5 && yp > 50 && touching == 1) TFT.fillcircle(yp, xp, 2, color); if(yp < 50) { // color buttons