LWJGL Forum

Programming => LWJGL Documentation => Topic started by: toyoPon3 on April 17, 2011, 02:48:27

Title: About org.lwjgl.input.Keyboard
Post by: toyoPon3 on April 17, 2011, 02: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?
 :)
Title: Re: About org.lwjgl.input.Keyboard
Post by: kappa on April 17, 2011, 11:04:16
You can use the Keyboard.getEventCharacter() method to get the key as a char directly instead of using getKeyEvent().
Title: Re: About org.lwjgl.input.Keyboard
Post by: toyoPon3 on April 17, 2011, 13: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.

 
Title: Re: About org.lwjgl.input.Keyboard
Post by: jediTofu on April 17, 2011, 16:42:39
This is probably the nicest post that I have ever read here.
Title: Re: About org.lwjgl.input.Keyboard
Post by: Fool Running on April 19, 2011, 12: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. :)