We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
keyCode (Read 1675 times)
keyCode
Feb 25th, 2010, 1:08am
 
Hello Guys.

I need some keyCodes and tried to use the ones from the Java Doc.
Unfortunalty processing seems to not know many of them. For example i tried to use VK_SPACE from Java anf wrote SPACE into my code but it doesnt work.
Is there a way to do so?

In detail i need:
Space
AltGr
A
W
S
D
Re: keyCode
Reply #1 - Feb 25th, 2010, 1:26am
 
no need to use keyCode
you can use
'a','w','s','d',' '(space),

check out : http://processing.org/reference/key.html

dont know ALT GR, though, somebody might help here
Re: keyCode
Reply #2 - Feb 25th, 2010, 1:26am
 
http://processing.org/reference/keyCode.html
http://processing.org/reference/key.html
Re: keyCode
Reply #3 - Feb 25th, 2010, 1:40am
 
Thanks for your suggestions about the single chars. But space doesnt work like that: if (keyCode == SPACE)  (and i used it in a proper context)
Re: keyCode
Reply #4 - Feb 25th, 2010, 2:27am
 
yes, space works like the chars.

// Click on the window to give it focus
// and press the SPACE

void draw() {
 if(keyPressed) {
   if (key == ' ') {
     fill(0);
   }
 } else {
   fill(255);
 }
 rect(25, 25, 50, 50);
}
Re: keyCode
Reply #5 - Feb 25th, 2010, 3:02am
 
ah thanks didnt thought about it being actually a char.
Re: keyCode
Reply #6 - Feb 25th, 2010, 5:04am
 
For the record, Alt Gr key, which is maybe only on non-Mac keyboard (or non-US?) is used to reach alternative characters. For example, on my French keyboard, I can use:
AltGr+2 -> ~
AltGr+3 -> #
AltGr+4 -> {
AltGr+e -> €
and so on.
Actually, this key just emits a combination of Alt+Ctrl...

Also note that the WSAD combo which is so popular in some games is totally impractical on non-US keyboards (non-QWERTY) (w on the bottom row, s and d on the middle and a on the top tow...).
Re: keyCode
Reply #7 - Feb 25th, 2010, 6:16am
 
yeah, the french are weird, always wanna be special, thats the price youve got to pay Wink
http://pages.slc.edu/~support/files/keyboard-layout-french-osx.gif

germans dont have any problems with wasd ... although we are NON US QUERTZ Users...http://carbon.cudenver.edu/~tphillip/german-keyboard-a.jpg
Page Index Toggle Pages: 1