pituicat/src/Affection.hs

35 lines
857 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-26 02:50:39 +00:00
, module Affection.Render
, module 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-26 02:50:39 +00:00
withWindow :: Monad m => Text -> WindowConfig -> RendererConfig -> RenderT m a -> IO ()
2016-03-25 15:58:46 +00:00
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-26 02:50:39 +00:00
withDefaultWindow :: Monad m => Text -> (RenderT m a) -> IO ()
2016-03-25 15:58:46 +00:00
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)