Hello Guest

About org.lwjgl.input.Keyboard

  • 4 Replies
  • 11991 Views
About org.lwjgl.input.Keyboard
« 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?
 :)

*

Offline kappa

  • *****
  • 1319
Re: About org.lwjgl.input.Keyboard
« Reply #1 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().
« Last Edit: April 17, 2011, 11:07:11 by kappa »

Re: About org.lwjgl.input.Keyboard
« Reply #2 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.

 

Re: About org.lwjgl.input.Keyboard
« Reply #3 on: April 17, 2011, 16:42:39 »
This is probably the nicest post that I have ever read here.
cool story, bro

Re: About org.lwjgl.input.Keyboard
« Reply #4 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. :)
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D