I want to extend the functionality of SpaceWars GamePadHelper but I don't know how to do it. What I need help with is to add Pushed functionality to all keys, like APushed as a complement to APressed.

I am doing a Track and Field game/clone and for the jumping and throwing events I want to increase the angle as long as the Up button is down.


Re: XNA Game Studio Express How to extend GamePadHelper?


I figured it out by myself. This is what I added:

private bool UpIsPushed;
private bool kbUpIsPushed;

/// <summary>
/// Has the up dpad been pushed
/// </summary>
public bool UpPushed
return ((checkPressed(state.DPad.Up, ref UpIsPushed))
|| (checkPressed(keyState.IsKeyUp(keyMapping.Get(GamePadKeys.Up)), ref kbUpIsPushed)));

Added this in, if (player == PlayerIndex.One):
if (keyState.IsKeyDown(Game1.Settings.Player1Up)) kbUpIsPushed = true;

Added this in, if (state.IsConnected):
if (state.DPad.Up == ButtonState.Pressed) UpIsPushed = true;