Defer setting the location and grabbing the mouse
Defer setting the location and grabbing the mouse

This effectively delays the location update on the virtual mouse object and also makes sure that the Robot movement for grabbing the mouse is only executed with the tickrate of the input loop. Previously this was dependent on the mouse refresh rate. e.g. A good gaming mouse with a refresh rate of 1000hz would cause 1000 calls to the Robot class per second. Since this operation is costly and might take more than 1ms this rendered a problem and was to my understanding even responsible for deadlocking the entire OS. This change effectively limits the amount of Robot calls to 60/sec (by default). Also: The virtual in-game cursor is rendered only with the fps rate anyway which makes the additional updates useless anyway.

The only problem with this change: The events of the Mouse class are still processed at the refresh rate of the actual mouse. I think we also might need to defer these events to ensure consistent information across the engine.

Issue #263

gurkenlabs/litiengine,gurkenlabs/litiengine