n00b question
in
Programming Questions
•
2 years ago
I have this code:
PFont f;
void setup() {
size(300,500);
f = createFont("Arial", 24, true);
}
void draw() {
size(1200,500);
background(255);
fill(100);
String timeActual = nf(hour(), 2) + ":" + nf(minute(),2) + ":" + nf(second(), 2);
if ((mouseX > 30) && (mouseX < 190) && (mouseY > 120) && (mouseY < 180)) { //top left button
fill(200,50,50,50);
rect(30,120,160,60);
noFill();
if(mousePressed) {
String timeLog = nf(hour(), 2) + ":" + nf(minute(),2) + ":" + nf(second(), 2);
}
}
text(timeActual,150, 250);
text(timeLog, 150, 270);
}
I need the string "timeLog" to appear as text. I try to make it public, it doesnt like it. I've moved the variable declaration around, it will not have any of that either. This really should be very simple, but it is giving me all this grief.
Thanks in advance for the help.
PFont f;
void setup() {
size(300,500);
f = createFont("Arial", 24, true);
}
void draw() {
size(1200,500);
background(255);
fill(100);
String timeActual = nf(hour(), 2) + ":" + nf(minute(),2) + ":" + nf(second(), 2);
if ((mouseX > 30) && (mouseX < 190) && (mouseY > 120) && (mouseY < 180)) { //top left button
fill(200,50,50,50);
rect(30,120,160,60);
noFill();
if(mousePressed) {
String timeLog = nf(hour(), 2) + ":" + nf(minute(),2) + ":" + nf(second(), 2);
}
}
text(timeActual,150, 250);
text(timeLog, 150, 270);
}
I need the string "timeLog" to appear as text. I try to make it public, it doesnt like it. I've moved the variable declaration around, it will not have any of that either. This really should be very simple, but it is giving me all this grief.
Thanks in advance for the help.
1