Skip to content

Instantly share code, notes, and snippets.

@ghostandthemachine
Created December 18, 2009 22:18
Show Gist options
  • Save ghostandthemachine/259801 to your computer and use it in GitHub Desktop.
Save ghostandthemachine/259801 to your computer and use it in GitHub Desktop.
class Toggle extends BaseObject{
Toggle(){
super("",1,1,mouseX,mouseY);
w = 25;
h = 25;
scaleable = false;
}
void display(){
super.display();
pushStyle();
stroke(0);
fill(cfillColor);
rect(x,y,w,h);
if(value % 2 != 0){
line(x + 3, y + 3, x + w - 3, y + h - 3);
line(x + w - 3, y + 3, x + 3, y + h - 3);
}
popStyle();
}
void press(int mx, int my){
super.press(mx,my);
if(editMode != true){
if(press){
value+=1;
println(value);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment