pong game added to the main sketch

Dependencies:   RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor

Fork of MainSketch by IoT Ox

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers drawStates.h Source File

drawStates.h

00001 
00002 
00003 void draw_state(int i)
00004 {
00005     TFT.cls();
00006     switch (i) {
00007         case (1):
00008             //buttons
00009             TFT.fillrect(0, 0, 50, 50, Red);
00010             TFT.fillrect(0, 50, 50, 100, Green);
00011             TFT.fillrect(0, 100, 50, 150, Blue);
00012             TFT.fillrect(0, 150, 50, 200, White);
00013             TFT.fillrect(0, 200, 50, 240, Black);
00014 
00015             TFT.rect(0, 0, 50, 50, White);
00016             TFT.rect(0, 50, 50, 100, White);
00017             TFT.rect(0, 100, 50, 150, White);
00018             TFT.rect(0, 150, 50, 200, White);
00019             TFT.rect(0, 200, 50, 240, White);
00020             //clock area
00021             TFT.rect(50, 0, 320, 100, White);
00022             //Day
00023             TFT.rect(50, 100, 140, 200, White);
00024             //Alarm Area
00025             TFT.rect(140, 100 , 320, 200, White);
00026             //Date Area
00027             TFT.rect(50, 200, 320, 240, White);
00028             //Colons
00029             int tx,ty = 0;
00030             ty = 50;
00031             tx = 140;
00032             TFT.fillcircle(tx, ty - 10, 2, White);
00033             TFT.fillcircle(tx, ty + 10, 2, White);
00034             tx = 230;
00035             TFT.fillcircle(tx, ty - 10, 2, White);
00036             TFT.fillcircle(tx, ty + 10, 2, White);
00037             ty = 150;
00038             TFT.fillcircle(tx, ty - 10, 2, White);
00039             TFT.fillcircle(tx, ty + 10, 2, White);
00040             break;
00041         case (2):
00042             //buttons
00043             TFT.fillrect(0, 0, 50, 50, Red);
00044             TFT.fillrect(0, 50, 50, 100, Green);
00045             TFT.fillrect(0, 100, 50, 150, Blue);
00046             TFT.fillrect(0, 150, 50, 200, White);
00047             TFT.fillrect(0, 200, 50, 240, Black);
00048 
00049             TFT.rect(0, 0, 50, 50, White);
00050             TFT.rect(0, 50, 50, 100, White);
00051             TFT.rect(0, 100, 50, 150, White);
00052             TFT.rect(0, 150, 50, 200, White);
00053             TFT.rect(0, 200, 50, 240, White);
00054             //Date Area
00055 
00056             //clock area
00057             TFT.rect(50, 0, 185, 1355, White);
00058             int r = 135/2;
00059             draw_clockface(50 + r, r, r, 3, White);
00060             //Alarm Area
00061             draw_clockface(185 + r, r, r, 3, White);
00062             TFT.rect(185, 0, 320, 1355, White);
00063             //Date Area
00064             TFT.rect(50, 135, 320, 240, White);
00065             break;
00066         case (3):
00067             whiteboard();
00068             break;
00069         case(4):
00070             drawsettingsbuttons();
00071             drawoutlines();
00072             break;
00073     }
00074 }
00075 
00076 
00077