pituicat/src/Affection.hs

35 lines
855 B
Haskell

module Affection
( withAllAffection
, withWindow
, withDefaultWindow
, delaySec
, Affection.Render
, 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 :: Text -> WindowConfig -> RendererConfig -> (Window -> Renderer -> IO ()) -> IO ()
withWindow title wconf rconf ops = do
window <- createWindow title wconf
renderer <- createRenderer window (-1) rconf
inRender renderer $ ops
destroyWindow window
withDefaultWindow :: Text -> (Window -> Renderer -> IO ()) -> IO ()
withDefaultWindow title ops = withWindow title defaultWindow defaultRenderer ops
delaySec :: Int -> IO ()
delaySec dur = delay (fromIntegral $ dur * 1000)