1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 12:58:33 +01:00

some controls helper methods

This commit is contained in:
Ellpeck 2020-05-04 16:41:54 +02:00
parent f8642dfb9e
commit efed3d9e12
2 changed files with 16 additions and 0 deletions

View file

@ -256,5 +256,9 @@ namespace MLEM.Ui {
this.SelectElement(this.ActiveRoot, next);
}
public static void AddButtons(ref object[] controls, params object[] additional) {
controls = controls.Concat(additional).ToArray();
}
}
}

View file

@ -303,6 +303,18 @@ namespace MLEM.Input {
throw new ArgumentException(nameof(control));
}
public bool IsAnyDown(params object[] control) {
return control.Any(c => this.IsDown(c));
}
public bool IsAnyUp(params object[] control) {
return control.Any(c => this.IsUp(c));
}
public bool IsAnyPressed(params object[] control) {
return control.Any(c => this.IsPressed(c));
}
public static void EnableGestures(params GestureType[] gestures) {
foreach (var gesture in gestures)
TouchPanel.EnabledGestures |= gesture;