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

only handle mouse input if the mouse is in the window

This commit is contained in:
Ell 2021-02-19 02:31:38 +01:00
parent 01b6168259
commit 73eab1d41e

View file

@ -181,7 +181,12 @@ namespace MLEM.Input {
if (this.HandleMouse) { if (this.HandleMouse) {
this.LastMouseState = this.MouseState; 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) { if (this.HandleGamepads) {