About org.lwjgl.input.Keyboard

Started by toyoPon3, April 17, 2011, 02:48:27

Previous topic - Next topic

toyoPon3

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?
:)

kappa

You can use the Keyboard.getEventCharacter() method to get the key as a char directly instead of using getKeyEvent().

toyoPon3

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.



jediTofu

This is probably the nicest post that I have ever read here.
cool story, bro

Fool Running

Quote from: jediTofu on April 17, 2011, 16:42:39
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. :)
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D