first itty bitty steps
This commit is contained in:
parent
0ab5a7d947
commit
8cb3dc21c4
2 changed files with 28 additions and 5 deletions
|
@ -26,7 +26,7 @@ cabal-version: >=1.10
|
||||||
|
|
||||||
library
|
library
|
||||||
exposed-modules: Affection
|
exposed-modules: Affection
|
||||||
|
extensions: OverloadedStrings
|
||||||
-- Modules included in this library but not exported.
|
-- Modules included in this library but not exported.
|
||||||
-- other-modules:
|
-- other-modules:
|
||||||
|
|
||||||
|
@ -37,7 +37,8 @@ library
|
||||||
-- Other library packages from which modules are imported.
|
-- Other library packages from which modules are imported.
|
||||||
build-depends: base >=4.8 && <4.9
|
build-depends: base >=4.8 && <4.9
|
||||||
, sdl2
|
, sdl2
|
||||||
, sdl2-image
|
, text
|
||||||
|
-- , sdl2-image
|
||||||
|
|
||||||
source-repository head
|
source-repository head
|
||||||
type: git
|
type: git
|
||||||
|
|
|
@ -1,6 +1,28 @@
|
||||||
module Affection
|
module Affection
|
||||||
( someFunc
|
( withAllAffection
|
||||||
|
, withWindow
|
||||||
|
, withDefaultWindow
|
||||||
|
, delaySec
|
||||||
) where
|
) where
|
||||||
|
|
||||||
someFunc :: IO ()
|
import SDL
|
||||||
someFunc = putStrLn "someFunc"
|
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)
|
||||||
|
|
Loading…
Reference in a new issue