Created
March 31, 2010 06:53
-
-
Save fjenett/350021 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// which part of the screen is my mouse in? | |
int grid; | |
void setup () | |
{ | |
size( 500, 500 ); | |
grid = 3; | |
} | |
void draw () | |
{ | |
background(205); | |
int rx = mouseX / (width/grid); // should precalc width/grid, height/grid | |
int ry = mouseY / (height/grid); | |
rect( rx*(width/grid), ry*(height/grid), (width/grid), (height/grid) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment