only consider mouse-move events as "active" (for framerate purposes) if the pointer is in the window area

This commit is contained in:
Colin McMillen 2023-08-26 13:14:24 -04:00
parent 6478f1ee95
commit bcb2e7be7d

View File

@ -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;