diff --git a/MLEM/Input/GenericInput.cs b/MLEM/Input/GenericInput.cs index ff88704..4905f83 100644 --- a/MLEM/Input/GenericInput.cs +++ b/MLEM/Input/GenericInput.cs @@ -39,6 +39,36 @@ namespace MLEM.Input { } } + /// + public override bool Equals(object obj) { + return obj is GenericInput o && this.Type == o.Type && this.value == o.value; + } + + /// + public override int GetHashCode() { + return ((int) this.Type * 397) ^ this.value; + } + + /// + /// Compares the two generic input instances for equality using + /// + /// The left input + /// The right input + /// Whether the two generic inputs are equal + public static bool operator ==(GenericInput left, GenericInput right) { + return left.Equals(right); + } + + /// + /// Compares the two generic input instances for inequality using + /// + /// The left input + /// The right input + /// Whether the two generic inputs are not equal + public static bool operator !=(GenericInput left, GenericInput right) { + return !left.Equals(right); + } + /// /// Converts a to a generic input. /// diff --git a/MLEM/Input/Keybind.cs b/MLEM/Input/Keybind.cs index 65718a5..18756cc 100644 --- a/MLEM/Input/Keybind.cs +++ b/MLEM/Input/Keybind.cs @@ -101,7 +101,13 @@ namespace MLEM.Input { [DataMember] public readonly GenericInput Key; - internal Combination(GenericInput key, GenericInput[] modifiers) { + /// + /// Creates a new combination with the given settings. + /// To add a combination to a , use instead. + /// + /// The key + /// The modifiers + public Combination(GenericInput key, GenericInput[] modifiers) { this.Modifiers = modifiers; this.Key = key; }