LWJGL
May 22, 2012, 15:53:41 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.8.3 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: About org.lwjgl.input.Keyboard  (Read 1463 times)
toyoPon3
Newbie
*
Posts: 7


« on: April 16, 2011, 19:48:27 »

Now, I am studying about LWJGL.
And I wrote the sample code noted below.
while (Keyboard.next()) {
  if (Keyboard.getEventKeyState()) {
    if (Keyboard.getEventKey() == Keyboard.KEY_A) {
      ....
    }
  }
}

Now I have some questions.

Questin1:
I want to convert the return value of getEventKey() into the ASCII code, directly.
Are there the function converting org.lwjgl.input Keyboard.KEY_A, org.lwjgl.input Keyboard.KEY_B etc into ASCII code?
If I need the function noted above, should I make the function by myself?
If you know the function, please tell me.

Questin2:
Why is the value of org.lwjgl.input Keyboard.KEY_A not same as the value of ASCII code of "A".
If you know the background, please tell me.

-----
P.S
I use the forum , this time is first.
Is my usage valid?
 Smiley
Logged
kappa
Administrator
Nerdus Imperius
*****
Posts: 961



« Reply #1 on: April 17, 2011, 04:04:16 »

You can use the Keyboard.getEventCharacter() method to get the key as a char directly instead of using getKeyEvent().
Logged
toyoPon3
Newbie
*
Posts: 7


« Reply #2 on: April 17, 2011, 06:05:55 »

To kappa.

Nice to meet you.
I try to use the function "getEventCharacter()", and my test program goes as planned.
Thank you for answering my questions.

 
Logged
jediTofu
Prolific Timewaster
****
Posts: 280



« Reply #3 on: April 17, 2011, 09:42:39 »

This is probably the nicest post that I have ever read here.
Logged

cool story, bro
Fool Running
Nerdus Imperius
*****
Posts: 648


« Reply #4 on: April 19, 2011, 05:27:19 »

This is probably the nicest post that I have ever read here.

Yeah, he's not yelling or complaining or insulting the LWJGL devs. He's actually friendly.

What a breath of fresh air. I think more people should be like him. Smiley
Logged

Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option Grin
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!