Cleanup preload, add basic frame time checking
This commit is contained in:
+9
-8
@@ -60,16 +60,17 @@ main = do
|
||||
(worldPictures w)
|
||||
blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
|
||||
renderFoldable (_renderData preData) (picToLTree Nothing $ fixedCoordPictures w)
|
||||
endRenderTicks <- SDL.ticks
|
||||
playSoundQueue (_soundData preData) (_soundQueue w)
|
||||
newSoundData <- playAndUpdate (_sounds w) (_soundData preData)
|
||||
endMixerTicks <- SDL.ticks
|
||||
return $ (preData {_soundData = newSoundData})
|
||||
& renderTime +~ (endRenderTicks - startTicks)
|
||||
& mixerTime +~ (endMixerTicks - endRenderTicks)
|
||||
& renderLighting +~ (lightTicks - startTicks)
|
||||
& renderPicture +~ (endRenderTicks - lightTicks)
|
||||
& pokeTime +~ timeSpentPoking
|
||||
|
||||
endTicks <- SDL.ticks
|
||||
let lastFrameTicks = _frameTimer preData
|
||||
renderFoldable (_renderData preData)
|
||||
(picToLTree Nothing . setLayer 1 . setDepth (-1)
|
||||
. translate 0 (-0.8) . scale 0.0005 0.0005
|
||||
. text $ show (endTicks - lastFrameTicks))
|
||||
return $ preData & soundData .~ newSoundData
|
||||
& frameTimer .~ endTicks
|
||||
)
|
||||
(flip $ menuEvents $ flip handleEvent)
|
||||
(\w -> Just $ update w)
|
||||
|
||||
Reference in New Issue
Block a user