keyPressed() "key" type (Processing in Eclipse)
in
Integration and Hardware
•
3 years ago
Consider the following example code:
I'm programming in Java. I want the PApplet extension to pass on the key that's pressed to other classes. The problem is, I can't write a method that takes the "key" parameter without knowing what it is. What kind of thing is "key," and what do I import in the other classes to make sense of it?
Thanks!
void keyPressed() {
if (key == CODED) {
if (keyCode == UP) {
// action here
} else if (keyCode == DOWN) {
// more action here
}
} else {
// do something
}
}
Thanks!
1