Couple loop with preload to allow for time "profiling"
This commit is contained in:
+19
-5
@@ -12,6 +12,10 @@ import System.Mem
|
||||
import Foreign.C
|
||||
import Geometry
|
||||
|
||||
import Preload
|
||||
|
||||
import Control.Lens ((.~),(&))
|
||||
|
||||
winConfig x y = defaultWindow
|
||||
{ windowGraphicsContext
|
||||
= OpenGLContext (defaultOpenGL { glProfile = Core Normal 4 3
|
||||
@@ -22,13 +26,23 @@ winConfig x y = defaultWindow
|
||||
, windowResizable =True
|
||||
}
|
||||
|
||||
--setupLoop :: String
|
||||
-- -> CInt
|
||||
-- -> CInt
|
||||
-- -> IO setupParams
|
||||
-- -> (setupParams -> IO ())
|
||||
-- -> world
|
||||
-- -> (setupParams -> world -> IO setupParams)
|
||||
-- -> (world -> Event -> Maybe world)
|
||||
-- -> (world -> Maybe world)
|
||||
-- -> IO ()
|
||||
setupLoop :: String
|
||||
-> CInt
|
||||
-> CInt
|
||||
-> IO setupParams
|
||||
-> (setupParams -> IO ())
|
||||
-> IO (PreloadData a)
|
||||
-> (PreloadData a -> IO ())
|
||||
-> world
|
||||
-> (setupParams -> world -> IO setupParams)
|
||||
-> (PreloadData a -> world -> IO (PreloadData a))
|
||||
-> (world -> Event -> Maybe world)
|
||||
-> (world -> Maybe world)
|
||||
-> IO ()
|
||||
@@ -62,11 +76,11 @@ doLoop setup window startWorld
|
||||
eventFn
|
||||
worldUpdate
|
||||
= do
|
||||
startLoopTicks <- ticks
|
||||
GL.clear [GL.ColorBuffer,GL.DepthBuffer]
|
||||
newParams <- worldSideEffects setup startWorld
|
||||
newParams <- worldSideEffects (setup & currentTime .~ startLoopTicks) startWorld
|
||||
glSwapWindow window
|
||||
--worldSideEffects setup updatedWorld
|
||||
startLoopTicks <- ticks
|
||||
events <- pollEvents
|
||||
--let-- maybeUpdatedWorld :: Maybe (WorldView world0)
|
||||
-- maybeUpdatedWorld = applyEvents eventFn startWorld events worldUpdate
|
||||
|
||||
Reference in New Issue
Block a user