Move universe IO effects outside of world
This commit is contained in:
+3
-3
@@ -82,6 +82,7 @@ firstWorldLoad theConfig = do
|
||||
,_menuLayers = []
|
||||
,_savedWorlds = M.empty
|
||||
,_keyConfig = theKeyConfig
|
||||
, _uvIOEffects = return
|
||||
, _uvTestString = testStringInit
|
||||
}
|
||||
|
||||
@@ -103,10 +104,9 @@ playSoundUnlessRewinding u
|
||||
|
||||
doSideEffects :: Universe -> IO Universe
|
||||
doSideEffects u = do
|
||||
let w = _uvWorld u
|
||||
let preData = _preloadData u
|
||||
newPlayingSounds <- playSoundUnlessRewinding u
|
||||
u' <- _sideEffects w u
|
||||
u' <- _uvIOEffects u u
|
||||
endTicks <- SDL.ticks
|
||||
let lastFrameTicks = _frameTimer preData
|
||||
when (debugOn Show_ms_frame $ _uvConfig u) $ void $ renderFoldable
|
||||
@@ -119,7 +119,7 @@ doSideEffects u = do
|
||||
& preloadData . frameTimer .~ endTicks
|
||||
& uvWorld . playingSounds .~ newPlayingSounds
|
||||
& uvWorld . toPlaySounds .~ M.empty
|
||||
& uvWorld . sideEffects .~ return
|
||||
& uvIOEffects .~ return
|
||||
|
||||
fpsText :: (Show a, Ord a, Num a) => a -> Picture
|
||||
fpsText x = color col $ text $ "ms/frame " ++ show x
|
||||
|
||||
Reference in New Issue
Block a user