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"
text <- G.gegl_node_new_child root $ G.textOperation
[ 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
]
traceM "text"

View File

@ -26,7 +26,10 @@ import Control.Concurrent.MVar
import Affection.Render
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
case initComponents of
All ->
@ -38,7 +41,6 @@ withAffection conf@AffectionConfig{..} = do
window <- SDL.createWindow windowTitle windowConfig
surface <- SDL.getWindowSurface window
initContainer <- return . (\x -> AffectionData
-- { affectionConfig = conf
{ quitEvent = False
, userState = x
, drawWindow = window
@ -62,6 +64,8 @@ withAffection conf@AffectionConfig{..} = do
G.gegl_exit
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
@ -75,8 +79,13 @@ withWindow title wconf rconf ops = do
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
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)