Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

No indians, please

  • Loading branch information...
commit da08b9419dd9e0789e37c3e4001b3daa24ed7b8f 1 parent 28081f2
Alexey Derlaft authored
Showing with 4 additions and 10 deletions.
  1. +4 −10 processing_interaction.java
View
14 processing_interaction.java
@@ -1,7 +1,6 @@
float bx;
float by;
int bs = 20;
-boolean bover = false;
boolean clicked = false;
void setup() {
@@ -16,20 +15,15 @@ void setup() {
void draw() {
background(#ffffff);
- // Test if the cursor is over the box
- if (mouseX > bx-bs && mouseX < bx+bs &&
- mouseY > by-bs && mouseY < by+bs) {
- bover = true;
- } else {
- bover = false;
- }
-
translate(100, 100);
rect(-40, -40, 80, 80);
}
void mousePressed() {
- if (bover) {
+
+ // Test if the cursor is over the box
+ if (mouseX > bx-bs && mouseX < bx+bs &&
+ mouseY > by-bs && mouseY < by+bs) {
if (clicked) {
fill(#52b755);
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.