47 lines
913 B
Haskell
47 lines
913 B
Haskell
|
{-# LANGUAGE ForeignFunctionInterface #-}
|
||
|
|
||
|
module Init where
|
||
|
|
||
|
import Affection as A
|
||
|
|
||
|
import SDL (($=))
|
||
|
import qualified SDL
|
||
|
|
||
|
import qualified Graphics.Rendering.OpenGL as GL
|
||
|
|
||
|
import NanoVG hiding (V2(..), V3(..))
|
||
|
|
||
|
import Linear
|
||
|
|
||
|
import Control.Monad.IO.Class (liftIO)
|
||
|
|
||
|
import Control.Concurrent.STM
|
||
|
|
||
|
import qualified Data.Set as S
|
||
|
import qualified Data.Map.Strict as M
|
||
|
import Data.Ecstasy
|
||
|
|
||
|
import Foreign.C.Types (CInt(..))
|
||
|
|
||
|
import Types
|
||
|
|
||
|
foreign import ccall unsafe "glewInit"
|
||
|
glewInit :: IO CInt
|
||
|
|
||
|
load :: IO UserData
|
||
|
load = do
|
||
|
_ <- glewInit
|
||
|
nvg <- createGL3 (S.fromList [Antialias, StencilStrokes])
|
||
|
subs <- Subsystems
|
||
|
<$> (Window <$> newTVarIO [])
|
||
|
<*> (Mouse <$> newTVarIO [])
|
||
|
w <- runSystemT defWorld getWorld
|
||
|
return UserData
|
||
|
{ state = Menu
|
||
|
, subsystems = subs
|
||
|
, assetImages = M.empty -- FILLME!
|
||
|
, nano = nvg
|
||
|
, uuid = []
|
||
|
, world = w
|
||
|
}
|