pituicat/src/Affection.hs
2016-03-26 03:50:39 +01:00

35 lines
857 B
Haskell

module Affection
( withAllAffection
, withWindow
, withDefaultWindow
, delaySec
, module Affection.Render
, module Affection.Types
) where
import SDL
import Data.Text
import qualified Control.Concurrent as CC
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
inRender renderer $ ops
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)