1
Vote

Rework GamePadState

description

Need someway to create an instance of GamePadState that can be returned from GamePad.GetState(). We can't use static variables here. Example.
 
state = GamePad.GetState();
 
if(state.IsPressed() && !_lastState.IsPressed())
DoSomethingWithADebounce();
 
_lastState = state;
 
This works fine in the XNA frameworks. I've KDW already implemented something for Keyboard, but GamePad looked a little more tricky

comments

kevindwolf wrote Mar 29, 2009 at 5:33 PM

Changed MapKeyboardToGamePadButton(Buttons b, System.Windows.Input.Key) to MapKeyboardToGamePadButton(Buttons b, SilverArcade.SilverSprite.Input.Keys)

kevindwolf wrote Mar 31, 2009 at 11:06 PM

Remaining issues:
1) It would appear the TargetElement.KeyDown event does not get fired for the Key.Enter
2) Code is in place for left and right trigger. Right now GetButtonState only goes from 1 to Input.Buttons.Y, not sure of the reasoning, but didn't want to change this.
3) In the test page, it would appear as if when you hit the space key, the KeyDown event fires, but then the Button captures focus and the test page never sees the KeyUp event, this the test is misleading