diff --git a/examples/example00.hs b/examples/example00.hs index a240d6d..8046990 100644 --- a/examples/example00.hs +++ b/examples/example00.hs @@ -26,6 +26,7 @@ main = do { initComponents = All , windowTitle = "Affection: example00" , windowConfig = SDL.defaultWindow + , preLoop = return () , drawLoop = draw , updateLoop = update , loadState = load diff --git a/examples/example01.hs b/examples/example01.hs index 084a844..2331e6f 100644 --- a/examples/example01.hs +++ b/examples/example01.hs @@ -26,6 +26,7 @@ main = do { initComponents = All , windowTitle = "Affection: example00" , windowConfig = SDL.defaultWindow + , preLoop = return () , drawLoop = draw , updateLoop = update , loadState = load diff --git a/src/Affection.hs b/src/Affection.hs index f776384..8352afa 100644 --- a/src/Affection.hs +++ b/src/Affection.hs @@ -1,6 +1,8 @@ {-# LANGUAGE RecordWildCards #-} module Affection ( withAffection + , getAffection + , putAffection -- , withWindow -- , withDefaultWindow , delaySec @@ -91,25 +93,20 @@ withAffection AffectionConfig{..} = do cleanUp $ userState nState SDL.quit --- -- | DEPRECATED! --- -- Function for bootstraping a window. --- withWindow :: Monad m => T.Text -> WindowConfig -> SDL.RendererConfig -> RenderT m a -> IO () --- withWindow title wconf rconf ops = do --- window <- SDL.createWindow title wconf --- -- I don't need a renderer here, i need a surface --- renderer <- SDL.createRenderer window (-1) rconf --- surface <- SDL.getWindowSurface window --- G.gegl_init --- -- I think I need some AffectionT or someting similar here and not a RenderT --- -- from SDL. --- inRender renderer $ ops --- G.gegl_exit --- SDL.destroyWindow window --- --- -- | DEPRECATED! --- -- Bootstrap a default window. --- withDefaultWindow :: Monad m => T.Text -> (RenderT m a) -> IO () --- withDefaultWindow title ops = withWindow title defaultWindow SDL.defaultRenderer ops +-- | Return the userstate to the user +getAffection :: Affection us us +getAffection = do + ad <- get + return $ userState ad + +-- | Put altered user state back +putAffection + :: us -- User state + -> Affection us () +putAffection us = do + ad <- get + put $ ad + { userState = us } -- | block a thread for a specified amount of time delaySec