mirror of
https://github.com/dyne/FreeJ.git
synced 2026-02-05 20:49:15 +01:00
processing-js 0.4 has been merged in some relevant parts basic and topic scripts added for test color handling fixed, more scripts show up now
63 lines
1.0 KiB
Plaintext
63 lines
1.0 KiB
Plaintext
boolean overLeftButton = false;
|
|
boolean overRightButton = false;
|
|
|
|
void setup()
|
|
{
|
|
size(200, 200);
|
|
}
|
|
|
|
void draw()
|
|
{
|
|
background(204);
|
|
|
|
// Left buttom
|
|
if(overLeftButton == true) {
|
|
fill(255);
|
|
} else {
|
|
noFill();
|
|
}
|
|
rect(20, 60, 75, 75);
|
|
rect(50, 90, 15, 15);
|
|
|
|
// Right button
|
|
if(overRightButton == true) {
|
|
fill(255);
|
|
} else {
|
|
noFill();
|
|
}
|
|
rect(105, 60, 75, 75);
|
|
line(135, 105, 155, 85);
|
|
line(140, 85, 155, 85);
|
|
line(155, 85, 155, 100);
|
|
}
|
|
|
|
void mousePressed()
|
|
{
|
|
if(overLeftButton) {
|
|
link("http://www.processing.org");
|
|
} else if (overRightButton) {
|
|
link("http://www.processing.org", "_new");
|
|
}
|
|
}
|
|
|
|
void mouseMoved() {
|
|
checkButtons();
|
|
}
|
|
|
|
void mouseDragged() {
|
|
checkButtons();
|
|
}
|
|
|
|
void checkButtons() {
|
|
if(mouseX > 20 && mouseX < 95 &&
|
|
mouseY > 60 && mouseY <135) {
|
|
overLeftButton = true;
|
|
} else if (mouseX > 105 && mouseX < 180 &&
|
|
mouseY > 60 && mouseY <135) {
|
|
overRightButton = true;
|
|
} else {
|
|
overLeftButton = overRightButton = false;
|
|
}
|
|
|
|
}
|