On 11/24/2012 01:33 PM, GiGurra [via jogamp] wrote:
> Is there any way to ask if a specific key is currently held down?
>
> On Windows 7 jdk 1.7.0_07 64 bit with jogl rc-11 NEWT keyboard callbacks
> automatically send key released for such keys that are automatically
> repeated/typed.
>
> How would I go about asking newt if a specific key is currently held down (as
> I due to the above cannot keep a record of it myself).
Yes, pls look at the following unit test, demonstrating how to suppress
auto-repeat keys.
<
http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyPressReleaseUnmaskRepeatAWT.java;h=c275139058b3b1ce5eb3e5aa111ee2ed75053e01;hb=HEAD>
Here is the API doc describing how key event are being delivered, incl. auto-repeat:
<
http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/newt/event/KeyEvent.html>
No - we don't provide a polling API gathering what keys are currently pressed,
since the API is event driven.
However, you can simply add this functionality while adding a KeyListener
and track PRESS/RELEASE events, while unmasking the auto-repeat keys.
~sven