affection/src/Affection.hs

29 lines
636 B
Haskell
Raw Normal View History

2016-03-25 08:41:22 +00:00
module Affection
2016-03-25 10:43:31 +00:00
( withAllAffection
, withWindow
, withDefaultWindow
, delaySec
2016-03-25 08:41:22 +00:00
) where
2016-03-25 10:43:31 +00:00
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)