Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
kappter
About Me:
Technology Teacher at Skyline High School
Blog:
http://kappterjournal.blogspot.com/
Website:
http://dl.dropbox.com/u/21278437/index.html
Twitter Link:
https://twitter.com/kappter
Facebook Link:
https://www.facebook.com/kkapptie
Linkedin Link:
http://www.linkedin.com/pub/ken-kapptie/5/966/b1/
kappter's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Using mousePressed...
[5 Replies]
27-Jan-2013 07:06 AM
Forum:
Programming Questions
Is mousePressed the best check here? Tried using noLoop but it obviously stops everything.
void setup() {
size(1250, 400);
background(255);
}
void draw() {
if (mouseX > 50 && mouseX < 150 && mousePressed == true) {
switchOn(50,100);
textSize(40);
fill(0);
text("128", 65, 75);
//noLoop();
} else if (mousePressed == false) {
switchOff(50,100);
}
if (mouseX > 200 && mouseX < 300 && mousePressed == true) {
switchOn(200,100);
textSize(40);
fill(0);
text("64", 225, 75);
//noLoop();
} else if (mousePressed == false) {
switchOff(200,100);
}
if (mouseX > 350 && mouseX < 450 && mousePressed == true) {
switchOn(350,100);
textSize(40);
fill(0);
text("32", 375, 75);
//noLoop();
} else if (mousePressed == false) {
switchOff(350,100);
}
if (mouseX > 500 && mouseX < 600 && mousePressed == true) {
switchOn(500,100);
textSize(40);
fill(0);
text("16", 525, 75);
//noLoop();
} else if (mousePressed == false) {
switchOff(500,100);
}
if (mouseX > 650 && mouseX < 750 && mousePressed == true) {
switchOn(650,100);
textSize(40);
fill(0);
text("8", 685, 75);
//noLoop();
} else if (mousePressed == false) {
switchOff(650,100);
}
if (mouseX > 800 && mouseX < 900 && mousePressed == true) {
switchOn(800,100);
textSize(40);
fill(0);
text("4", 835, 75);
//noLoop();
} else if (mousePressed == false) {
switchOff(800,100);
}
if (mouseX > 950 && mouseX < 1050 && mousePressed == true) {
switchOn(950,100);
textSize(40);
fill(0);
text("2", 985, 75);
//noLoop();
} else {
switchOff(950,100);
}
if (mouseX > 1100 && mouseX < 1200 && mousePressed == true) {
switchOn(1100,100);
textSize(40);
fill(0);
text("1", 1140, 75);
} else {
switchOff(1100,100);
}
}
void switchOn(int x, int y) {
fill(50);
strokeWeight(3);
rect(x, y, 100, 250);
fill(100);
rect(x, y+125, 100, 125);
textSize(32);
fill(225);
text("ON", x+29, y+195);
}
void switchOff(int x, int y) {
fill(100);
strokeWeight(3);
rect(x, y, 100, 250);
fill(50);
rect(x, y+125, 100, 125);
textSize(32);
fill(225);
text("OFF", x+19, y+75);
}
«Prev
Next »
Moderate user : kappter
Forum