diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2017-11-26 14:56:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-26 14:56:20 -0500 |
commit | c0c65ec6ddcf50c2a97fa74ebf94e714892ba3c2 (patch) | |
tree | d1b5daf0b7261639526c1cbaf7efa19b7d6b359e | |
parent | 3a832b99bf3f82cfe39de776b5e15db6c8ddff1a (diff) | |
parent | 0330d84e990883a5bd5f98a70570bde007713414 (diff) | |
download | SMAPI-c0c65ec6ddcf50c2a97fa74ebf94e714892ba3c2.tar.gz SMAPI-c0c65ec6ddcf50c2a97fa74ebf94e714892ba3c2.tar.bz2 SMAPI-c0c65ec6ddcf50c2a97fa74ebf94e714892ba3c2.zip |
Merge pull request #389 from YonKuma/suppressmouse
add code to suppress mouse clicks
-rw-r--r-- | src/SMAPI/Events/EventArgsInput.cs | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/SMAPI/Events/EventArgsInput.cs b/src/SMAPI/Events/EventArgsInput.cs index ff904675..276bfef6 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,34 @@ namespace StardewModdingAPI.Events Game1.oldPadState = new GamePadState(thumbsticks, triggers, buttons, dpad); } + + // mouse + else if (button == SButton.MouseLeft) + { + Game1.oldMouseState = new MouseState( + Game1.oldMouseState.X, + Game1.oldMouseState.Y, + Game1.oldMouseState.ScrollWheelValue, + ButtonState.Pressed, + Game1.oldMouseState.MiddleButton, + Game1.oldMouseState.RightButton, + Game1.oldMouseState.XButton1, + Game1.oldMouseState.XButton2 + ); + } + else if (button == SButton.MouseRight) + { + Game1.oldMouseState = new MouseState( + Game1.oldMouseState.X, + Game1.oldMouseState.Y, + Game1.oldMouseState.ScrollWheelValue, + Game1.oldMouseState.LeftButton, + Game1.oldMouseState.MiddleButton, + ButtonState.Pressed, + Game1.oldMouseState.XButton1, + Game1.oldMouseState.XButton2 + ); + } } } } |