Silverlight keydown event for games
I'm trying to use the key down event in silverlight for a game I'm working on. The problem I'm having is that silverlight treats keydown like windows does. For example if you hold down the left arrow key the keydown event triggers once, then pauses for a short while before triggering repeatedly.
Obviously in a game this won't do since a player expects to be able to hold 开发者_Python百科a key down to repeat an action without a pause in event.
So how do I get key down events constantly without the brief pause between the first key down event and the following repeated events?
I believe it only repeats the KeyDown and not the KeyUp, so you would need to track the state of previous KeyUp events yourself to determine if the key was/is already pressed.
Keyboard support for games in Silverlight is not great (e.g. does not allow for multiple simultaneous keys). You really want the ability to ask if certain keys are pressed (like the old scan-keycode system), but that is not a browser-friendly thing.
精彩评论