diff --git a/CHANGELOG.md b/CHANGELOG.md index 6908733..1dd2a2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Additions - Added SpriteBatchContext struct and extensions - Added InputHandler.InvertPressBehavior - Added ReverseInput, ReverseOutput and AndThen to Easings +- Added an Enum constructor to GenericInput Improvements - Allow comparing Keybind and Combination based on the amount of modifiers they have diff --git a/MLEM/Input/GenericInput.cs b/MLEM/Input/GenericInput.cs index 4432454..761699d 100644 --- a/MLEM/Input/GenericInput.cs +++ b/MLEM/Input/GenericInput.cs @@ -60,6 +60,16 @@ namespace MLEM.Input { /// The button to convert. public GenericInput(Buttons button) : this(InputType.Gamepad, (int) button) {} + /// + /// Creates a new generic input from the given value. + /// If the value is a , or , the appropriate and value will be set. Otherwise, the will be set to . + /// + /// The value to convert. + public GenericInput(Enum value) { + this.Type = value is MouseButton ? InputType.Mouse : value is Keys ? InputType.Keyboard : value is Buttons ? InputType.Gamepad : InputType.None; + this.value = Convert.ToInt32(value); + } + private GenericInput(InputType type, int value) { this.Type = type; this.value = value;