fix more UserData stuff

This commit is contained in:
nek0 2020-05-05 01:23:40 +02:00
parent adf5eefcdc
commit 808ab1db06
2 changed files with 24 additions and 19 deletions

View file

@ -11,6 +11,7 @@ import Codec.Picture as CP
import Codec.Picture.Extra import Codec.Picture.Extra
import Control.Concurrent.STM import Control.Concurrent.STM
import Control.Concurrent.MVar
import Data.String import Data.String
import qualified Data.Set as S import qualified Data.Set as S
@ -36,21 +37,25 @@ init = do
<*> (SubTranslator <$> newTVarIO []) <*> (SubTranslator <$> newTVarIO [])
_ <- glewInit _ <- glewInit
nvg <- createGL3 (S.fromList [NanoVG.Debug, Antialias, StencilStrokes]) nvg <- createGL3 (S.fromList [NanoVG.Debug, Antialias, StencilStrokes])
return UserData UserData
{ state = Load <$> newMVar Load
, subsystems = subs <*> pure subs
, assetImages = M.empty <*> newMVar M.empty
, assetAnimations = M.empty <*> newMVar M.empty
, assetFonts = M.empty <*> newMVar M.empty
, assetIcons = M.empty <*> newMVar M.empty
, nano = nvg <*> newMVar NoController
, uuid = [] <*> newMVar NoTranslation
, stateData = None <*> pure nvg
, threadContext = Nothing <*> newMVar []
, controls = NoController <*> newEmptyMVar
, translation = NoTranslation <*> newMVar None
, joyCache = [] <*> newEmptyMVar
} <*> newMVar (0, "foobar!")
<*> newMVar Nothing
<*> newMVar Nothing
<*> newMVar []
<*> newEmptyMVar
loadPlayerSprite loadPlayerSprite
:: FilePath -- Path to spritemap :: FilePath -- Path to spritemap

View file

@ -30,19 +30,19 @@ data UserData = UserData
, assetImages :: MVar (M.Map ImgId Image) , assetImages :: MVar (M.Map ImgId Image)
, assetFonts :: MVar (M.Map FontId T.Text) , assetFonts :: MVar (M.Map FontId T.Text)
, assetAnimations :: MVar (M.Map AnimId Animation) , assetAnimations :: MVar (M.Map AnimId Animation)
, controls :: Controller , controls :: MVar Controller
, translation :: MVar Translation , translation :: MVar Translation
, nano :: Context , nano :: Context
, uuid :: MVar [UUID] , uuid :: MVar [UUID]
, worldState :: SystemState Entity (AffectionState AffectionData IO) , worldState :: MVar (SystemState Entity (AffectionState AffectionData IO))
, stateData :: MVar StateData , stateData :: MVar StateData
, stateMVar :: MVar , stateMVar :: MVar
( SystemState Entity (AffectionState AffectionData IO) ( SystemState Entity (AffectionState AffectionData IO)
, StateData , StateData
) )
, stateProgress :: MVar (Float, T.Text) , stateProgress :: MVar (Float, T.Text)
, threadContext :: Maybe SDL.GLContext , threadContext :: MVar (Maybe SDL.GLContext)
, window :: Maybe SDL.Window , window :: MVar (Maybe SDL.Window)
, joyCache :: MVar [JoystickMessage] , joyCache :: MVar [JoystickMessage]
, joyUUID :: MVar UUID , joyUUID :: MVar UUID
} }