mirror of
https://github.com/z0w0/helm.git
synced 2024-09-11 04:15:32 +03:00
Fixed an incorrect computation of delay.
This commit is contained in:
parent
89c8a56238
commit
377700d5ce
@ -167,9 +167,10 @@ delayIfNeeded
|
||||
-> Double -- ^ Current time.
|
||||
-> IO () -- ^ An IO monad that delays the main thread to ensure that frames are not rendered faster than limit allows.
|
||||
delayIfNeeded Unlimited _ _ = return ()
|
||||
delayIfNeeded (Limited fpsLimit) lastRender currentTime = do
|
||||
if delay > 0
|
||||
delayIfNeeded (Limited fpsLimit) lastRender currentTime = if delay > 0
|
||||
then threadDelay delay
|
||||
else putStrLn "Warning: FPS degradation. You may want to tune your update or FPS limits."
|
||||
where
|
||||
delay = ceiling $ 1000*(currentTime - lastRender) - (fromIntegral fpsLimit)
|
||||
microsecondsLimitPerFrame = ceiling $ 1000000.0 / (fromIntegral fpsLimit)
|
||||
microsecondsForLastFrame = ceiling $ currentTime - lastRender
|
||||
delay = microsecondsLimitPerFrame - microsecondsForLastFrame
|
||||
|
Loading…
Reference in New Issue
Block a user