Skip to main content
gamedev.net
🔒 Locked

[java] Noob question: keyboard input

Started by EGD Eric 4 replies 1k views
Original Post
EGD Eric
EGD Eric
I've looked through the sample applets that came with jdk5.0, but I found nothing on this. I did the tutorial: Java Game Programming parts I & II, and I'm still a bit stymied. In part 2 they talk about keyboard input, but they don't say much, just to print the results of the last key pressed to the screen, so you'll know what numbers represent which arrow (using the Keydown method). I tried this, but the values I get on the screen are always strange: For left/right I get something that looks like a weird t (more like a cross), for up I get 6, for down I... also get 6, but the character looks different. All this just to say that I'm actually trying to get an answer on my own. In C, I used to just go into debug, see what value I got in debug, then made some #defines for those keys. Or, just use the existing #defines that are already there VK_DOWN or something, once I knew about them. So how do I do simple keyboard input with the arrows?
EGD Eric
EGD Eric
yes it does, thanks!
guillermoro
guillermoro
Quick question, what tutorial are you reffering to when you say "The Java tutorial part 1 and 2", could you tell me the URL. If you looked at the one im thinking of i have to warn you its horrible
EGD Eric
EGD Eric
Here's part I:
http://www.gamedev.net/reference/articles/article1262.asp

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.