summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events/EventArgsInput.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-12-02 18:49:49 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-12-02 18:49:49 -0500
commit5cc5f089b9645a60385ff293b5a7202f260bfc0f (patch)
tree68f8bee734d164277f711b8ac54bd1064c0757d6 /src/SMAPI/Events/EventArgsInput.cs
parente0b72374cd14298aacc6f71dc391fdc9814be37c (diff)
parentdc4f89acb6cd8f838934b60e8f5645c6145706f8 (diff)
downloadSMAPI-5cc5f089b9645a60385ff293b5a7202f260bfc0f.tar.gz
SMAPI-5cc5f089b9645a60385ff293b5a7202f260bfc0f.tar.bz2
SMAPI-5cc5f089b9645a60385ff293b5a7202f260bfc0f.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Events/EventArgsInput.cs')
-rw-r--r--src/SMAPI/Events/EventArgsInput.cs19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/SMAPI/Events/EventArgsInput.cs b/src/SMAPI/Events/EventArgsInput.cs
index ff904675..54ce9b53 100644
--- a/src/SMAPI/Events/EventArgsInput.cs
+++ b/src/SMAPI/Events/EventArgsInput.cs
@@ -56,11 +56,11 @@ namespace StardewModdingAPI.Events
public void SuppressButton(SButton button)
{
// keyboard
- if (this.Button.TryGetKeyboard(out Keys key))
+ if (button.TryGetKeyboard(out Keys key))
Game1.oldKBState = new KeyboardState(Game1.oldKBState.GetPressedKeys().Union(new[] { key }).ToArray());
// controller
- else if (this.Button.TryGetController(out Buttons controllerButton))
+ else if (button.TryGetController(out Buttons controllerButton))
{
var newState = GamePad.GetState(PlayerIndex.One);
var thumbsticks = Game1.oldPadState.ThumbSticks;
@@ -127,6 +127,21 @@ namespace StardewModdingAPI.Events
Game1.oldPadState = new GamePadState(thumbsticks, triggers, buttons, dpad);
}
+
+ // mouse
+ else if (button == SButton.MouseLeft || button == SButton.MouseMiddle || button == SButton.MouseRight || button == SButton.MouseX1 || button == SButton.MouseX2)
+ {
+ Game1.oldMouseState = new MouseState(
+ x: Game1.oldMouseState.X,
+ y: Game1.oldMouseState.Y,
+ scrollWheel: Game1.oldMouseState.ScrollWheelValue,
+ leftButton: button == SButton.MouseLeft ? ButtonState.Pressed : Game1.oldMouseState.LeftButton,
+ middleButton: button == SButton.MouseMiddle ? ButtonState.Pressed : Game1.oldMouseState.MiddleButton,
+ rightButton: button == SButton.MouseRight ? ButtonState.Pressed : Game1.oldMouseState.RightButton,
+ xButton1: button == SButton.MouseX1 ? ButtonState.Pressed : Game1.oldMouseState.XButton1,
+ xButton2: button == SButton.MouseX2 ? ButtonState.Pressed : Game1.oldMouseState.XButton2
+ );
+ }
}
}
}