mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-25 22:18:34 +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 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 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 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
|
Removals
|
||||||
- Marked EnumHelper as obsolete due to its reimplementation in [DynamicEnums](https://www.nuget.org/packages/DynamicEnums)
|
- Marked EnumHelper as obsolete due to its reimplementation in [DynamicEnums](https://www.nuget.org/packages/DynamicEnums)
|
||||||
|
|
|
@ -406,35 +406,31 @@ namespace MLEM.Input {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns whether this combination's modifier keys are currently down
|
/// Returns whether all of this combination's modifier keys are currently down.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="handler">The input handler to query the keys with</param>
|
/// <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>
|
/// <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>
|
/// <returns>Whether this combination's modifiers are down</returns>
|
||||||
public bool IsModifierDown(InputHandler handler, int gamepadIndex = -1) {
|
public bool IsModifierDown(InputHandler handler, int gamepadIndex = -1) {
|
||||||
if (this.Modifiers.Length <= 0)
|
|
||||||
return true;
|
|
||||||
foreach (var modifier in this.Modifiers) {
|
foreach (var modifier in this.Modifiers) {
|
||||||
if (handler.IsDown(modifier, gamepadIndex))
|
if (!handler.IsDown(modifier, gamepadIndex))
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
/// <param name="handler">The input handler to query the keys with</param>
|
/// <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>
|
/// <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>
|
/// <returns>Whether this combination's modifiers were down</returns>
|
||||||
public bool WasModifierDown(InputHandler handler, int gamepadIndex = -1) {
|
public bool WasModifierDown(InputHandler handler, int gamepadIndex = -1) {
|
||||||
if (this.Modifiers.Length <= 0)
|
|
||||||
return true;
|
|
||||||
foreach (var modifier in this.Modifiers) {
|
foreach (var modifier in this.Modifiers) {
|
||||||
if (handler.WasDown(modifier, gamepadIndex))
|
if (!handler.WasDown(modifier, gamepadIndex))
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in a new issue