Add file, move buffer swapping into doDrawing
This commit is contained in:
+6
-4
@@ -200,7 +200,8 @@ setupConLoop' ::
|
||||
---- | Concurrent effects. Evaluating 'Nothing' exits the loop
|
||||
(world -> ConcurrentEffect world) ->
|
||||
-- | update, called once per frame. Allows for side effects such as rendering.
|
||||
(world -> IO world) ->
|
||||
-- passes the window to allow buffer swapping
|
||||
(Window -> world -> IO world) ->
|
||||
-- | SDL Event handling, once per frame. Note no side effects.
|
||||
(world -> Event -> world) ->
|
||||
IO ()
|
||||
@@ -232,7 +233,7 @@ doConLoop' ::
|
||||
(world -> ConcurrentEffect world) ->
|
||||
-- | simulation update. Allows for side effects such as rendering.
|
||||
-- passes the window to allow buffer swapping at different times
|
||||
(world -> IO world) ->
|
||||
(Window -> world -> IO world) ->
|
||||
-- | SDL Event handling. Note no side effects.
|
||||
(world -> Event -> world) ->
|
||||
-- | Current simulation state.
|
||||
@@ -240,6 +241,7 @@ doConLoop' ::
|
||||
IO ()
|
||||
doConLoop' themvar spf window coneffs worldSideEffects eventFn !startWorld = go startWorld
|
||||
where
|
||||
worldSideEffectsWindow = worldSideEffects window
|
||||
go sw = do
|
||||
startTicks <- ticks
|
||||
es <- pollEvents
|
||||
@@ -258,8 +260,8 @@ doConLoop' themvar spf window coneffs worldSideEffects eventFn !startWorld = go
|
||||
case mstartWorld' of
|
||||
Nothing -> return ()
|
||||
Just startWorld' -> do
|
||||
worldAfterSimStep <- worldSideEffects startWorld'
|
||||
glSwapWindow window
|
||||
worldAfterSimStep <- worldSideEffectsWindow startWorld'
|
||||
-- glSwapWindow window
|
||||
let updatedWorld = foldl' eventFn worldAfterSimStep es
|
||||
performGC
|
||||
endTicks <- ticks -- it might be better to use System.Clock (monotonic)
|
||||
|
||||
Reference in New Issue
Block a user