updating examples

This commit is contained in:
nek0 2016-12-12 02:10:30 +01:00
parent 663ffca664
commit b0d44124dc
3 changed files with 18 additions and 19 deletions

View file

@ -26,6 +26,7 @@ main = do
{ initComponents = All
, windowTitle = "Affection: example00"
, windowConfig = SDL.defaultWindow
, preLoop = return ()
, drawLoop = draw
, updateLoop = update
, loadState = load

View file

@ -26,6 +26,7 @@ main = do
{ initComponents = All
, windowTitle = "Affection: example00"
, windowConfig = SDL.defaultWindow
, preLoop = return ()
, drawLoop = draw
, updateLoop = update
, loadState = load

View file

@ -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