diff --git a/MLEM/Input/InputHandler.cs b/MLEM/Input/InputHandler.cs index 8781dee..3da5667 100644 --- a/MLEM/Input/InputHandler.cs +++ b/MLEM/Input/InputHandler.cs @@ -286,6 +286,7 @@ namespace MLEM.Input { /// /// Returns whether the given key is considered pressed. /// A key is considered pressed if it was not down the last update call, but is down the current update call. + /// If is true, this method will also return true to signify a key repeat. /// /// The key to query /// If the key is pressed @@ -293,6 +294,17 @@ namespace MLEM.Input { // if the queried key is the held key and a repeat should be triggered, return true if (this.HandleKeyboardRepeats && key == this.heldKey && this.triggerKeyRepeat) return true; + return this.IsKeyPressedIgnoreRepeats(key); + } + + /// + /// Returns whether the given key is considered pressed. + /// This has the same behavior as , but ignores keyboard repeat events. + /// If is false, this method does the same as . + /// + /// The key to query + /// If the key is pressed + public bool IsKeyPressedIgnoreRepeats(Keys key) { return this.WasKeyUp(key) && this.IsKeyDown(key); } @@ -398,6 +410,7 @@ namespace MLEM.Input { /// /// Returns whether the given gamepad button on the given index is considered pressed. /// A gamepad button is considered pressed if it was down the last update call, and is up the current update call. + /// If is true, this method will also return true to signify a gamepad button repeat. /// /// The button to query /// The zero-based index of the gamepad, or -1 for any gamepad @@ -412,6 +425,18 @@ namespace MLEM.Input { return true; } } + return this.IsGamepadButtonPressedIgnoreRepeats(button, index); + } + + /// + /// Returns whether the given key is considered pressed. + /// This has the same behavior as , but ignores gamepad repeat events. + /// If is false, this method does the same as . + /// + /// The button to query + /// The zero-based index of the gamepad, or -1 for any gamepad + /// Whether the given button is pressed + public bool IsGamepadButtonPressedIgnoreRepeats(Buttons button, int index = -1) { return this.WasGamepadButtonUp(button, index) && this.IsGamepadButtonDown(button, index); }