mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-25 22:18:34 +01:00
Added GenericInput support for Buttons.None
This commit is contained in:
parent
59af00c89a
commit
1795acb30e
2 changed files with 4 additions and 9 deletions
|
@ -21,6 +21,7 @@ Additions
|
||||||
Improvements
|
Improvements
|
||||||
- Allow comparing Keybind and Combination based on the amount of modifiers they have
|
- Allow comparing Keybind and Combination based on the amount of modifiers they have
|
||||||
- Allow using multiple textures in a StaticSpriteBatch
|
- Allow using multiple textures in a StaticSpriteBatch
|
||||||
|
- Added GenericInput support for Buttons.None
|
||||||
|
|
||||||
Removals
|
Removals
|
||||||
- Marked AStar.InfiniteCost as obsolete
|
- Marked AStar.InfiniteCost as obsolete
|
||||||
|
|
|
@ -24,13 +24,7 @@ namespace MLEM.Input {
|
||||||
/// Returns this generic input's <see cref="Keys"/>.
|
/// Returns this generic input's <see cref="Keys"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <exception cref="InvalidOperationException">If this generic input's <see cref="Type"/> is not <see cref="InputType.Keyboard"/> or <see cref="InputType.None"/>.</exception>
|
/// <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 {
|
public Keys Key => this.Type == InputType.None ? 0 : this.Type == InputType.Keyboard ? (Keys) this.value : throw new InvalidOperationException();
|
||||||
get {
|
|
||||||
if (this.Type == InputType.None)
|
|
||||||
return Keys.None;
|
|
||||||
return this.Type == InputType.Keyboard ? (Keys) this.value : throw new InvalidOperationException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns this generic input's <see cref="MouseButton"/>.
|
/// Returns this generic input's <see cref="MouseButton"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -39,8 +33,8 @@ namespace MLEM.Input {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns this generic input's <see cref="Buttons"/>.
|
/// Returns this generic input's <see cref="Buttons"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <exception cref="InvalidOperationException">If this generic input's <see cref="Type"/> is not <see cref="InputType.Gamepad"/>.</exception>
|
/// <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.Gamepad ? (Buttons) this.value : throw new InvalidOperationException();
|
public Buttons Button => this.Type == InputType.None ? 0 : this.Type == InputType.Gamepad ? (Buttons) this.value : throw new InvalidOperationException();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new generic input from the given keyboard <see cref="Keys"/>.
|
/// Creates a new generic input from the given keyboard <see cref="Keys"/>.
|
||||||
|
|
Loading…
Reference in a new issue