pituicat/src/Affection.hs
2016-04-26 22:33:35 +02:00

36 lines
851 B
Haskell

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
renderer <- createRenderer window (-1) rconf
gegl_init
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)