[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Missing keyborad events

Douglas Pollock wrote:
Martin Bosticky wrote:

I have implemented a keyboard listener based on
org.eclipse.swt.events.KeyListener in a SWT application. The program is
a game and i am tracking the keys 'a', 'w', 's' and 's' to move a
character on a canvas.

If i press two keys, and then release them, i seem to only get one call
to the keyReleased() function. Thus my game gets confused and my
character keeps moving even when keys are released.

Is there another way i can inspect the state of the keyboard in SWT
which would be more reliable? Can anyone recommend a proper way to
achieve the desired behavior?


In my experience, KeyUp events in SWT are unreliable.  AFAIK, it's not
possible to implement a game of that sort in SWT.



cheers,
d.


OK. Sounds like we would need to implement SWT extension to GetKeyState or GetKeyboardState windows API (and other APIs). I will investigate at the developers mailing list.


Thanks, martin.