We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I need a way to return a value from keyPressed (or some user input from keyboard) stored in a variable and have not been able to find any way of doing so. I would like it to be something like below. I'm new to Processing, but have done a bit of C++, so I am trying to find a way around cin >> from C++.
String keyPressed() {
if (key == '\n' ) {
saved = typing;
typing = "";
} else {
typing = typing + key;
}
return saved;
}
Answers
http://forum.processing.org/two/discussion/8045/how-to-format-code-and-text
You're declaring Processing's keyPressed() callback function w/ a diff. signature!
Please read its reference here: https://processing.org/reference/keyPressed_.html
And btW, 2 online examples using keyPressed(): B-)
I think I have figured it out, thanks! I update if anything is amiss :)