cleanup and documentation

This commit is contained in:
nek0 2016-11-06 05:02:06 +01:00
parent 1ccdf4ad75
commit c7ab44e2f9
2 changed files with 13 additions and 4 deletions

View file

@ -51,7 +51,7 @@ load _ = do
traceM "over" traceM "over"
text <- G.gegl_node_new_child root $ G.textOperation text <- G.gegl_node_new_child root $ G.textOperation
[ G.Property "string" $ G.PropertyString "Hello world!" [ G.Property "string" $ G.PropertyString "Hello world!"
, G.Property "color" $ G.PropertyColor $ G.RGB 0 0 1 -- , G.Property "color" $ G.PropertyColor $ G.RGBA 0 0 1 0.1
, G.Property "size" $ G.PropertyDouble 40 , G.Property "size" $ G.PropertyDouble 40
] ]
traceM "text" traceM "text"

View file

@ -26,7 +26,10 @@ import Control.Concurrent.MVar
import Affection.Render import Affection.Render
import Affection.Types as Types import Affection.Types as Types
withAffection :: AffectionConfig us -> IO () -- | Main function which bootstraps everything else.
withAffection
:: AffectionConfig us -- ^ Configuration of the Game and its engine.
-> IO ()
withAffection conf@AffectionConfig{..} = do withAffection conf@AffectionConfig{..} = do
case initComponents of case initComponents of
All -> All ->
@ -38,7 +41,6 @@ withAffection conf@AffectionConfig{..} = do
window <- SDL.createWindow windowTitle windowConfig window <- SDL.createWindow windowTitle windowConfig
surface <- SDL.getWindowSurface window surface <- SDL.getWindowSurface window
initContainer <- return . (\x -> AffectionData initContainer <- return . (\x -> AffectionData
-- { affectionConfig = conf
{ quitEvent = False { quitEvent = False
, userState = x , userState = x
, drawWindow = window , drawWindow = window
@ -62,6 +64,8 @@ withAffection conf@AffectionConfig{..} = do
G.gegl_exit G.gegl_exit
SDL.quit SDL.quit
-- | DEPRECATED!
-- Function for bootstraping a window.
withWindow :: Monad m => T.Text -> WindowConfig -> SDL.RendererConfig -> RenderT m a -> IO () withWindow :: Monad m => T.Text -> WindowConfig -> SDL.RendererConfig -> RenderT m a -> IO ()
withWindow title wconf rconf ops = do withWindow title wconf rconf ops = do
window <- SDL.createWindow title wconf window <- SDL.createWindow title wconf
@ -75,8 +79,13 @@ withWindow title wconf rconf ops = do
G.gegl_exit G.gegl_exit
SDL.destroyWindow window SDL.destroyWindow window
-- | DEPRECATED!
-- Bootstrap a default window.
withDefaultWindow :: Monad m => T.Text -> (RenderT m a) -> IO () withDefaultWindow :: Monad m => T.Text -> (RenderT m a) -> IO ()
withDefaultWindow title ops = withWindow title defaultWindow SDL.defaultRenderer ops withDefaultWindow title ops = withWindow title defaultWindow SDL.defaultRenderer ops
delaySec :: Int -> IO () -- | block a thread for a specified amount of time
delaySec
:: Int -- ^ Number of seconds
-> IO ()
delaySec dur = SDL.delay (fromIntegral $ dur * 1000) delaySec dur = SDL.delay (fromIntegral $ dur * 1000)