I am trying to create a basic input interface for project I am working on and am running into a bug where the keyPressed variable always returns false. Here’s the basic idea of the code.
void setup() {
int startTime = millis();
while (startTime + 60000 > millis()) {
println(keyPressed);
}
}
That works; however, for what I need to do, I need this to work in the setup method. I have a method like this in a class which I then call in another class’s constructor. I would just use the Scanner class, but Processing does not have native console support.
Thank you. The loop using the timer is simply because Processing does not allow infinite loops with a break statement within. I could possibly change it to check a boolean and update that boolean when the needed condition is met.
?? did you try that code ( what is a made from your class )
did you see that it does not see the keyboard
in side that while loop ( not even running inside draw() )
Oh. Yes. I realized that after I posted my reply. It also doesn’t even work when I change the while statement to a different conditional. I am probably going to give up on trying to incorporate an interface into my project; it isn’t necessary, and it seems Processing really makes it difficult to develop anything like that.
now that is a point where the experts might help you with,
if you able to describe what you try to do???
( nothing about class and setup … , the pure function you need ?)
Essentially, I’m trying to develop something like the Scanner class for Processing since Processing doesn’t support native console input. This is in order to set variables within another class.