Missing keyborad events [message #464696] |
Mon, 28 November 2005 21:50 |
Eclipse User |
|
|
|
Originally posted by: none.none.com
Hi
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?
Many regards, Martin.
|
|
|
|
Re: Missing keyborad events [message #464764 is a reply to message #464758] |
Tue, 29 November 2005 16:45 |
Eclipse User |
|
|
|
Originally posted by: none.none.com
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.
|
|
|
Powered by
FUDForum. Page generated in 0.02467 seconds