pituicat/src/Affection.hs

29 lines
636 B
Haskell

module Affection
( withAllAffection
, withWindow
, withDefaultWindow
, delaySec
) where
import SDL
import Data.Text
import qualified Control.Concurrent as CC
withAllAffection :: IO () -> IO ()
withAllAffection ops = do
initializeAll
ops
quit
withWindow :: Text -> WindowConfig -> (Window -> IO ()) -> IO ()
withWindow title conf ops = do
window <- createWindow title conf
ops window
destroyWindow window
withDefaultWindow :: Text -> (Window -> IO ()) -> IO ()
withDefaultWindow title ops = withWindow title defaultWindow ops
delaySec :: Int -> IO ()
delaySec dur = delay (fromIntegral $ dur * 1000)