1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 04:53:29 +01:00

Added GenericInput support for Buttons.None

This commit is contained in:
Ell 2022-06-15 11:44:28 +02:00
parent 59af00c89a
commit 1795acb30e
2 changed files with 4 additions and 9 deletions

View file

@ -21,6 +21,7 @@ Additions
Improvements
- Allow comparing Keybind and Combination based on the amount of modifiers they have
- Allow using multiple textures in a StaticSpriteBatch
- Added GenericInput support for Buttons.None
Removals
- Marked AStar.InfiniteCost as obsolete

View file

@ -24,13 +24,7 @@ namespace MLEM.Input {
/// Returns this generic input's <see cref="Keys"/>.
/// </summary>
/// <exception cref="InvalidOperationException">If this generic input's <see cref="Type"/> is not <see cref="InputType.Keyboard"/> or <see cref="InputType.None"/>.</exception>
public Keys Key {
get {
if (this.Type == InputType.None)
return Keys.None;
return this.Type == InputType.Keyboard ? (Keys) this.value : throw new InvalidOperationException();
}
}
public Keys Key => this.Type == InputType.None ? 0 : this.Type == InputType.Keyboard ? (Keys) this.value : throw new InvalidOperationException();
/// <summary>
/// Returns this generic input's <see cref="MouseButton"/>.
/// </summary>
@ -39,8 +33,8 @@ namespace MLEM.Input {
/// <summary>
/// Returns this generic input's <see cref="Buttons"/>.
/// </summary>
/// <exception cref="InvalidOperationException">If this generic input's <see cref="Type"/> is not <see cref="InputType.Gamepad"/>.</exception>
public Buttons Button => this.Type == InputType.Gamepad ? (Buttons) this.value : throw new InvalidOperationException();
/// <exception cref="InvalidOperationException">If this generic input's <see cref="Type"/> is not <see cref="InputType.Gamepad"/> or <see cref="InputType.None"/>.</exception>
public Buttons Button => this.Type == InputType.None ? 0 : this.Type == InputType.Gamepad ? (Buttons) this.value : throw new InvalidOperationException();
/// <summary>
/// Creates a new generic input from the given keyboard <see cref="Keys"/>.