From 1795acb30e99babdce01b51f81feed630c21e2ad Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 15 Jun 2022 11:44:28 +0200 Subject: [PATCH] Added GenericInput support for Buttons.None --- CHANGELOG.md | 1 + MLEM/Input/GenericInput.cs | 12 +++--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 434a040..289bd44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/MLEM/Input/GenericInput.cs b/MLEM/Input/GenericInput.cs index 47c40f9..00ef235 100644 --- a/MLEM/Input/GenericInput.cs +++ b/MLEM/Input/GenericInput.cs @@ -24,13 +24,7 @@ namespace MLEM.Input { /// Returns this generic input's . /// /// If this generic input's is not or . - 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(); /// /// Returns this generic input's . /// @@ -39,8 +33,8 @@ namespace MLEM.Input { /// /// Returns this generic input's . /// - /// If this generic input's is not . - public Buttons Button => this.Type == InputType.Gamepad ? (Buttons) this.value : throw new InvalidOperationException(); + /// If this generic input's is not or . + public Buttons Button => this.Type == InputType.None ? 0 : this.Type == InputType.Gamepad ? (Buttons) this.value : throw new InvalidOperationException(); /// /// Creates a new generic input from the given keyboard .