From 73eab1d41ef3176887b2a495ed458ab1bb3a1327 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 19 Feb 2021 02:31:38 +0100 Subject: [PATCH] only handle mouse input if the mouse is in the window --- MLEM/Input/InputHandler.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MLEM/Input/InputHandler.cs b/MLEM/Input/InputHandler.cs index ded3f3b..ce2417d 100644 --- a/MLEM/Input/InputHandler.cs +++ b/MLEM/Input/InputHandler.cs @@ -181,7 +181,12 @@ namespace MLEM.Input { if (this.HandleMouse) { this.LastMouseState = this.MouseState; - this.MouseState = active ? Mouse.GetState() : default; + this.MouseState = default; + if (active) { + var state = Mouse.GetState(); + if (this.Game.GraphicsDevice.Viewport.Bounds.Contains(state.Position)) + this.MouseState = state; + } } if (this.HandleGamepads) {