pituicat/src/Affection.hs

35 lines
855 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 15:58:46 +00:00
, Affection.Render
, Affection.Types
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
2016-03-25 15:58:46 +00:00
import Affection.Render
import Affection.Types
2016-03-25 10:43:31 +00:00
withAllAffection :: IO () -> IO ()
withAllAffection ops = do
initializeAll
ops
quit
2016-03-25 15:58:46 +00:00
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
2016-03-25 10:43:31 +00:00
destroyWindow window
2016-03-25 15:58:46 +00:00
withDefaultWindow :: Text -> (Window -> Renderer -> IO ()) -> IO ()
withDefaultWindow title ops = withWindow title defaultWindow defaultRenderer ops
2016-03-25 10:43:31 +00:00
delaySec :: Int -> IO ()
delaySec dur = delay (fromIntegral $ dur * 1000)