public bool AsDPadPushedRepeatRate(Xbox360GamePad.DPadDirection direction, double timeAfterPush, double timeBetweenRepeating) { if (AsDPadPushed(direction)) { return(true); } // If this method is called multiple times per frame this line // of code guarantees that the user will get true every time until // the next TimeManager.Update (next frame). bool repeatedThisFrame = mLastDPadPush[(int)direction] == TimeManager.CurrentTime; if (repeatedThisFrame || ( AsDPadDown(direction) && TimeManager.CurrentTime - mLastDPadPush[(int)direction] > timeAfterPush && TimeManager.CurrentTime - mLastDPadRepeatRate[(int)direction] > timeBetweenRepeating) ) { mLastDPadRepeatRate[(int)direction] = TimeManager.CurrentTime; return(true); } return(false); }
public bool AsDPadPushed(Xbox360GamePad.DPadDirection direction) { // If the last was not down and this one is, then report a push. return(mLastDPadDown[(int)direction] == false && AsDPadDown(direction)); }
public bool AsDPadPushedRepeatRate(Xbox360GamePad.DPadDirection direction) { // Ignoring is performed inside this call. return(AsDPadPushedRepeatRate(direction, .35, .12)); }
public bool AsDPadDown(Xbox360GamePad.DPadDirection direction) { switch (direction) { case Xbox360GamePad.DPadDirection.Left: if (mLastDPadDown[(int)Xbox360GamePad.DPadDirection.Left]) { return(mPosition.X < -DPadOffValue); } else { return(mPosition.X < -DPadOnValue); } //break; case Xbox360GamePad.DPadDirection.Right: if (mLastDPadDown[(int)Xbox360GamePad.DPadDirection.Right]) { return(mPosition.X > DPadOffValue); } else { return(mPosition.X > DPadOnValue); } //break; case Xbox360GamePad.DPadDirection.Up: if (mLastDPadDown[(int)Xbox360GamePad.DPadDirection.Up]) { return(mPosition.Y > DPadOffValue); } else { return(mPosition.Y > DPadOnValue); } //break; case Xbox360GamePad.DPadDirection.Down: if (mLastDPadDown[(int)Xbox360GamePad.DPadDirection.Down]) { return(mPosition.Y < -DPadOffValue); } else { return(mPosition.Y < -DPadOnValue); } //break; default: return(false); //break; } }