diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-04-29 21:55:26 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-04-29 21:55:26 -0400 |
commit | fec6adf82d5eda99c6bf34a21b0e01adc2b10d22 (patch) | |
tree | 54d7317c3fda592a9d9833cbede0603cbec3ef66 /src/SMAPI/Framework/Input/GamePadStateBuilder.cs | |
parent | 2dcd88deb147759c3ce9be3ccaeaf0625bd6d4a5 (diff) | |
download | SMAPI-fec6adf82d5eda99c6bf34a21b0e01adc2b10d22.tar.gz SMAPI-fec6adf82d5eda99c6bf34a21b0e01adc2b10d22.tar.bz2 SMAPI-fec6adf82d5eda99c6bf34a21b0e01adc2b10d22.zip |
fix build error on Linux/Mac
Diffstat (limited to 'src/SMAPI/Framework/Input/GamePadStateBuilder.cs')
-rw-r--r-- | src/SMAPI/Framework/Input/GamePadStateBuilder.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/SMAPI/Framework/Input/GamePadStateBuilder.cs b/src/SMAPI/Framework/Input/GamePadStateBuilder.cs index 5eeb7ef6..33557385 100644 --- a/src/SMAPI/Framework/Input/GamePadStateBuilder.cs +++ b/src/SMAPI/Framework/Input/GamePadStateBuilder.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; @@ -133,7 +132,7 @@ namespace StardewModdingAPI.Framework.Input rightThumbStick: this.RightStickPos, leftTrigger: this.LeftTrigger, rightTrigger: this.RightTrigger, - buttons: this.GetPressedButtons().ToArray() + buttons: this.GetBitmask(this.GetPressedButtons()) // MonoDevelop requires one bitmask here; don't specify multiple values ); } @@ -149,5 +148,15 @@ namespace StardewModdingAPI.Framework.Input yield return button; } } + + /// <summary>Get a bitmask representing the given buttons.</summary> + /// <param name="buttons">The buttons to represent.</param> + private Buttons GetBitmask(IEnumerable<Buttons> buttons) + { + Buttons flag = 0; + foreach (Buttons button in buttons) + flag |= button; + return flag; + } } } |