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:
wrenczes@gmail.com
2011-09-11 02:41:14 +00:00
parent 1e0268eb07
commit f46ec14ce6

View File

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