MikeExample

TouchShield Code to draw on a slide and stealth





void setup()
{
background(0,0,0); //this paints the whole background black
stroke(0,0,255); //the outline of the next shape I draw will be blue
fill(0,0,255); //the inside fill of the next shape I draw will be blue
}

void loop()
{
gettouch(); //find out where a finger is touching
ellipse(mouseX, mouseY, 3, 3); // draw an ellipse(x, y, width, height)
}




___________

TouchShield line drawing function code to draw on a slide and stealth



void setup()
{
background(0,0,0);// set the screen black
}

unsigned int Xstore; //setup temporary variable
unsigned int Ystore; //setup temporary variable

void loop()
{
delay(10); //the delay function works… delays for 10ms

gettouch(); //find the pixel location that correlates to a screen touch

// Only update when there was an actual touch
if ( mouseX != Xstore || mouseY != Ystore )
{
stroke(0,0,0); //set color black
line(64, 64, Xstore, Ystore); //erase previous line… color black
line(64, 64, Xstore+1, Ystore+1); //erase previous line… color black
line(64, 64, Xstore+1, Ystore-1); //erase previous line… color black
line(64, 64, Xstore-1, Ystore-1); //erase previous line… color black
line(64, 64, Xstore+1, Ystore+1); //erase previous line… color black

stroke(70,70,255); //set the color to blue

//draws a blue line from (64,64) to the point of a press
line(64, 64, mouseX, mouseY);
line(64, 64, mouseX+1, mouseY+1);
line(64, 64, mouseX+1, mouseY-1);
line(64, 64, mouseX-1, mouseY-1);
line(64, 64, mouseX+1, mouseY+1);

//store previous touches for the erase function
Xstore = mouseX;
Ystore = mouseY;
}
}







Edit History