private bool IsButtonPressed(InputButton Button, KeyboardState KS, GamePadState GS) { switch (Button.Type) { case InputMethod.Key: return(KS.IsKeyDown(Button.Key)); case InputMethod.Button: return(GS.IsButtonDown(Button.Button)); default: throw new ArgumentOutOfRangeException("Button.Type"); } }
/// <summary> /// Registers the given InputButton to cause this Bind to be triggered. /// </summary> public void RegisterButton(InputButton Button) { this._Buttons.Add(Button); }
private bool IsButtonPressed(InputButton Button, KeyboardState KS, GamePadState GS) { switch(Button.Type) { case InputMethod.Key: return KS.IsKeyDown(Button.Key); case InputMethod.Button: return GS.IsButtonDown(Button.Button); default: throw new ArgumentOutOfRangeException("Button.Type"); } }
/// <summary> /// Unregisters the given InputButton from triggering this Bind. /// </summary> public void UnregisterButton(InputButton Button) { bool result = this._Buttons.Remove(Button); if(!result) throw new ArgumentException("Button was not associated with this Bind."); }