2018-02-07 00:18:16 +00:00
|
|
|
{-# 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
|
|
|
|
|
2018-02-15 18:42:07 +00:00
|
|
|
import Floorplan
|
|
|
|
|
|
|
|
import Debug.Trace
|
|
|
|
|
2018-02-07 00:18:16 +00:00
|
|
|
foreign import ccall unsafe "glewInit"
|
|
|
|
glewInit :: IO CInt
|
|
|
|
|
|
|
|
load :: IO UserData
|
|
|
|
load = do
|
|
|
|
_ <- glewInit
|
2018-02-18 03:11:12 +00:00
|
|
|
nvg <- createGL3 (S.fromList [StencilStrokes])
|
2018-02-07 00:18:16 +00:00
|
|
|
subs <- Subsystems
|
|
|
|
<$> (Window <$> newTVarIO [])
|
|
|
|
<*> (Mouse <$> newTVarIO [])
|
2018-02-24 14:33:46 +00:00
|
|
|
(ws, w) <- yieldSystemT (0, defWorld) (getWorld)
|
2018-02-07 00:18:16 +00:00
|
|
|
return UserData
|
|
|
|
{ state = Menu
|
|
|
|
, subsystems = subs
|
|
|
|
, assetImages = M.empty -- FILLME!
|
|
|
|
, nano = nvg
|
|
|
|
, uuid = []
|
|
|
|
, world = w
|
2018-02-24 14:33:46 +00:00
|
|
|
, worldState = ws
|
2018-02-17 01:36:06 +00:00
|
|
|
, stateData = None
|
2018-02-07 00:18:16 +00:00
|
|
|
}
|