module Affection ( withAllAffection , withWindow , withDefaultWindow , delaySec , module Affection.Render , module Affection.Types ) where import SDL import Data.Text import GEGL import Affection.Render import Affection.Types withAllAffection :: IO () -> IO () withAllAffection ops = do initializeAll ops quit withWindow :: Monad m => Text -> WindowConfig -> RendererConfig -> RenderT m a -> IO () withWindow title wconf rconf ops = do window <- createWindow title wconf -- I don't need a renderer here, i need a surface renderer <- createRenderer window (-1) rconf surface <- getWindowSurface window gegl_init -- I think I need some AffectionT or someting similar here and not a RenderT -- from SDL. inRender renderer $ ops gegl_exit destroyWindow window withDefaultWindow :: Monad m => Text -> (RenderT m a) -> IO () withDefaultWindow title ops = withWindow title defaultWindow defaultRenderer ops delaySec :: Int -> IO () delaySec dur = delay (fromIntegral $ dur * 1000)