mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 12:58:33 +01:00
Fixed Combination.IsModifierDown querying one of its modifiers instead of all of them
This commit is contained in:
parent
8bb62a2ce5
commit
5906278091
2 changed files with 9 additions and 12 deletions
|
@ -34,6 +34,7 @@ Fixes
|
|||
- Fixed TokenizedString handling trailing spaces incorrectly in the last line of non-left aligned text
|
||||
- Fixed some TokenizedString tokens starting with a line break not being split correctly
|
||||
- Fixed InputHandler maintaining old input states when input types are toggled off
|
||||
- Fixed Combination.IsModifierDown querying one of its modifiers instead of all of them
|
||||
|
||||
Removals
|
||||
- Marked EnumHelper as obsolete due to its reimplementation in [DynamicEnums](https://www.nuget.org/packages/DynamicEnums)
|
||||
|
|
|
@ -406,35 +406,31 @@ namespace MLEM.Input {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether this combination's modifier keys are currently down
|
||||
/// Returns whether all of this combination's modifier keys are currently down.
|
||||
/// </summary>
|
||||
/// <param name="handler">The input handler to query the keys with</param>
|
||||
/// <param name="gamepadIndex">The index of the gamepad to query, or -1 to query all gamepads</param>
|
||||
/// <returns>Whether this combination's modifiers are down</returns>
|
||||
public bool IsModifierDown(InputHandler handler, int gamepadIndex = -1) {
|
||||
if (this.Modifiers.Length <= 0)
|
||||
return true;
|
||||
foreach (var modifier in this.Modifiers) {
|
||||
if (handler.IsDown(modifier, gamepadIndex))
|
||||
return true;
|
||||
if (!handler.IsDown(modifier, gamepadIndex))
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether this combination's modifier keys were down in the last update call.
|
||||
/// Returns whether all of this combination's modifier keys were down in the last update call.
|
||||
/// </summary>
|
||||
/// <param name="handler">The input handler to query the keys with</param>
|
||||
/// <param name="gamepadIndex">The index of the gamepad to query, or -1 to query all gamepads</param>
|
||||
/// <returns>Whether this combination's modifiers were down</returns>
|
||||
public bool WasModifierDown(InputHandler handler, int gamepadIndex = -1) {
|
||||
if (this.Modifiers.Length <= 0)
|
||||
return true;
|
||||
foreach (var modifier in this.Modifiers) {
|
||||
if (handler.WasDown(modifier, gamepadIndex))
|
||||
return true;
|
||||
if (!handler.WasDown(modifier, gamepadIndex))
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in a new issue