From bcb2e7be7d67f1492c2c05d23857e49f07216cb6 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Sat, 26 Aug 2023 13:14:24 -0400 Subject: [PATCH] only consider mouse-move events as "active" (for framerate purposes) if the pointer is in the window area --- Program.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Program.cs b/Program.cs index 35d7381..aa3c23c 100644 --- a/Program.cs +++ b/Program.cs @@ -425,7 +425,10 @@ public class Game : GameWindow { toast.Update(e.Time); KeyboardState input = KeyboardState; - if (input.IsAnyKeyDown || MouseState.IsAnyButtonDown || MouseState.Delta != Vector2i.Zero) { + bool mouseInWindow = ClientRectangle.ContainsInclusive((Vector2i) MouseState.Position); + if (input.IsAnyKeyDown || + MouseState.IsAnyButtonDown || + (mouseInWindow && MouseState.Delta != Vector2i.Zero)) { timeSinceEvent = 0; } else { timeSinceEvent += e.Time;