/*
Processing Setup and Draw
Copy all of this into a new Procssing window (control-n (^n) gets you a new window)
Run it, and move the mouse across the window.
See the rectangles drawn where the mouse is.
See the mouse coordinates printed on screen and
in the console window (at the bottom).
See the frameCount number on screen, and frameCount mod 100 (=remainder)
Why doesn't the trail of mouse rectangles remain on the grey rectangle?
What's that grey rectangle for? Try commenting it out.
In the Basic Shapes sketch (Processing calls programs 'sketches') Processing runs through the sketch once. The usual way to run Processing is to have a function called 'setup' and one called 'draw'. Setup is run once at the start, and draw repeats forever.
*/
void setup()
{
// Setup runs once at the start.
// Set the size of the window.
size(500, 400);
}
void draw()
{
// Draw runs repeatedly.
// Show some numbers
fill(120);
rect(230, 20, 140, 50);
textAlign(RIGHT);
textSize(18);
fill(0, 200, 200);
text(mouseX, 300, 40);
text(mouseY, 360, 40);
fill(0, 240, 160);
text(frameCount, 300, 60);
text(frameCount % 100, 360, 60); // % is mod, same as remainder
fill(0, 0, 220);
// draw a rectangle where the mouse is.
rect(mouseX, mouseY, 4, 4);
// print the mouse coordinates
println(String.format("%4d %4d", mouseX, mouseY));
}