Refactor framebuffer update
This commit is contained in:
+18
-20
@@ -27,9 +27,10 @@ import Music
|
||||
import Preload
|
||||
import Preload.Render
|
||||
--import Render
|
||||
|
||||
import SDL (($=))
|
||||
import qualified SDL
|
||||
import qualified SDL.Mixer as Mix
|
||||
import SDL (($=))
|
||||
import Sound
|
||||
import System.Directory
|
||||
|
||||
@@ -77,27 +78,25 @@ firstWorldLoad :: Configuration -> IO Universe
|
||||
firstWorldLoad theConfig = do
|
||||
SDL.cursorVisible $= False
|
||||
pdata <- doPreload >>= applyWorldConfig theConfig
|
||||
--return $ startNewGame $ Universe
|
||||
cancontinue <- doesFileExist "saveSlot/0"
|
||||
mseed <- loadSeed
|
||||
let u = Universe
|
||||
{ --{_uvWorld = initialWorld
|
||||
_uvWorld = splashScreen
|
||||
, _uvConfig = theConfig
|
||||
, _preloadData = pdata
|
||||
, _uvScreenLayers = []
|
||||
, _uvIOEffects = return
|
||||
, _uvTestString = testStringInit
|
||||
, _uvSideEffects = mempty
|
||||
, _uvCanContinue = cancontinue
|
||||
, _uvMSeed = mseed
|
||||
, _uvLastFrameTicks = 0
|
||||
, _uvFrameTicks = 0
|
||||
}
|
||||
let u =
|
||||
Universe
|
||||
{ _uvWorld = splashScreen
|
||||
, _uvConfig = theConfig
|
||||
, _preloadData = pdata
|
||||
, _uvScreenLayers = []
|
||||
, _uvIOEffects = return
|
||||
, _uvTestString = testStringInit
|
||||
, _uvSideEffects = mempty
|
||||
, _uvCanContinue = cancontinue
|
||||
, _uvMSeed = mseed
|
||||
, _uvLastFrameTicks = 0
|
||||
, _uvFrameTicks = 0
|
||||
}
|
||||
return $
|
||||
Universe
|
||||
{ --{_uvWorld = initialWorld
|
||||
_uvWorld = splashScreen
|
||||
{ _uvWorld = splashScreen
|
||||
, _uvConfig = theConfig
|
||||
, _preloadData = pdata
|
||||
, _uvScreenLayers = [splashMenu u]
|
||||
@@ -115,8 +114,7 @@ theUpdateStep win = doSideEffects <=< updateRenderSplit win
|
||||
|
||||
updateRenderSplit :: SDL.Window -> Universe -> IO Universe
|
||||
updateRenderSplit win u = do
|
||||
let preData = _preloadData u
|
||||
updateUniverse u `par` void (doDrawing win (_renderData preData) u)
|
||||
updateUniverse u `par` void (doDrawing win u)
|
||||
return $! updateUniverse u
|
||||
|
||||
playSoundUnlessRewinding :: Universe -> IO (M.Map SoundOrigin Sound)
|
||||
|
||||
Reference in New Issue
Block a user