Close

Paint

A project log for Arduino Game Console - the BlueOkiris Gameduino

An arduino uno based game console.

Blue OkirisBlue Okiris 08/01/2014 at 15:001 Comment

Added a small paint program. It boots when you leave out your SD card. Again, will post as Version 2 as soon as I make the RPG.

Discussions

CircuitBurner wrote 08/27/2014 at 15:07 point
Here is a good paint program I worked on for the Seeed studios v2 TFT.
10 colors and 5 brushes...you must pick a brush (1,2,3,4,5) before it draws.
Code is below
-----------------------------------------
//START OF PROGRAM CODE

// Rusty's Mini-Paint - 1.4

// Revision 1.4 --- 5 variable thickness strokes + 2 added colors ---- by CircuitBurner ---- 7/25/14

// LATEST REVISION FOR USING SEEED STUDIOS TFT V-2 SCREEN

#include
#include
#include
#include

unsigned int TS2_MINX, TS2_MAXX, TS2_MINY, TS2_MAXY;
unsigned int MapX1, MapX2, MapY1, MapY2;
unsigned int s;
TouchScreen ts = TouchScreen(17, A2, A1, 14, 300);
int color = WHITE;
void setup()
{
Tft.TFTinit();
initTouchScreenParameters();
Tft.fillRectangle(0,0,15,20,BRIGHT_RED);
Tft.fillRectangle(15,0,15,20,RED);
Tft.fillRectangle(30,0,15,20,GREEN);
Tft.fillRectangle(45,0,15,20,BLUE);
Tft.fillRectangle(60,0,15,20,CYAN);
Tft.fillRectangle(75,0,15,20,YELLOW);
Tft.fillRectangle(90,0,15,20,WHITE);
Tft.fillRectangle(105,0,15,20,GRAY1);
Tft.fillRectangle(120,0,15,20,GRAY2);
Tft.fillRectangle(135,0,15,20,BLACK);
Tft.drawRectangle(156,0,17,20,BRIGHT_RED);
Tft.drawRectangle(173,0,17,20,BRIGHT_RED);
Tft.drawRectangle(190,0,17,20,BRIGHT_RED);
Tft.drawRectangle(207,0,17,20,BRIGHT_RED);
Tft.drawRectangle(224,0,17,20,BRIGHT_RED);
Tft.drawRectangle(0,0,150,20,GRAY2);
}
void loop()
{
;Point p = ts.getPoint();
if (p.z > ts.pressureThreshhold) {
p.x = map(p.x, TS2_MINX, TS2_MAXX, MapX1, MapX2);
p.y = map(p.y, TS2_MINY, TS2_MAXY, MapY1, MapY2);
if(p.y < 20)
{if(p.x >= 0 && p.x < 15)
{color = BRIGHT_RED;}
if(p.x >= 16 && p.x < 30)
{color = RED;
}if(p.x >= 31 && p.x < 45)
{color = GREEN;}
if(p.x >= 46 && p.x < 60)
{color = BLUE;}
if(p.x >= 61 && p.x < 75)
{color = CYAN;}
if(p.x >= 76 && p.x < 90)
{color = YELLOW;}
if(p.x >= 91 && p.x < 105)
{color = WHITE;}
if(p.x >= 106 && p.x < 120)
{color = GRAY1;}
if(p.x >= 121 && p.x < 135)
{color = GRAY2;}
if(p.x >= 136 && p.x < 150)
{color = BLACK;}
if(p.x >= 156 && p.x < 173)
{s = 11;}
if(p.x >= 172 && p.x < 189)
{s = 7;}
if(p.x >= 190 && p.x < 207)
{s = 4;}
if(p.x >= 208 && p.x < 225)
{s = 2;}
if(p.x >= 226 && p.x < 243)
{s = 1;}
}
else
{

Tft.fillCircle(p.x,p.y,s,color);
}
}
}

void initTouchScreenParameters()
{

//if(Tft.IC_CODE == 0x5408)
{
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
ts = TouchScreen(54, A1, A2, 57, 300);
#else
ts = TouchScreen(14, A1, A2, 17, 300);
#endif
TS2_MINX = 120;
TS2_MAXX = 910;
TS2_MINY = 120;
TS2_MAXY = 950;

MapX1 = 239;
MapX2 = 0;
MapY1 = 0;
MapY2 = 319;
}
// else {
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
ts = TouchScreen(57, A2, A1, 54, 300);
#else
ts = TouchScreen(17, A2, A1, 14, 300);
#endif
Tft.drawString("Rusty's Mini-Paint v1.4",98,308,1,BLUE);
Tft.drawString("Rusty's Mini-Paint v1.4",101,309,1,WHITE);
Tft.drawString("5",160,7,1,BLUE);
Tft.drawString("5",162,8,1,YELLOW);
Tft.drawString("4",177,7,1,BLUE);
Tft.drawString("4",179,8,1,YELLOW);
Tft.drawString("3",195,7,1,BLUE);
Tft.drawString("3",197,8,1,YELLOW);
Tft.drawString("2",211,7,1,BLUE);
Tft.drawString("2",213,8,1,YELLOW);
Tft.drawString("1",227,7,1,BLUE);
Tft.drawString("1",229,8,1,YELLOW);
TS2_MINX = 140;
TS2_MAXX = 900;
TS2_MINY = 120;
TS2_MAXY = 940;
MapX1 = 239;
MapX2 = 0;
MapY1 = 319;
MapY2 = 0;}


//END OF PROGRAM CODE

  Are you sure? yes | no