Fix for the mouse lag on windows. The issue with the mouse events lagging badly is that the while loop on SDL_WaitEventTimeout means that we'll wait consecutively 10 ms per mouse event, so we get flooded & never call onUpdate until the mouse stops moving. Replaced the gate with a simple for loop that guarantees that we call onUpdate at least once every 50 ms. We can try to tweak the value for better framerates, but this value seemed to be in the right ballpark.
This commit is contained in:
@@ -118,7 +118,7 @@ public:
|
||||
{
|
||||
if (g_engine)
|
||||
{
|
||||
while(SDL_WaitEventTimeout(&Event, 10))
|
||||
for (int x = 0; x < 5 && SDL_WaitEventTimeout(&Event, 10); ++x)
|
||||
{
|
||||
if(!g_engine->IsPaused())
|
||||
OnEvent(&Event);
|
||||
|
||||
Reference in New Issue
Block a user