nanovg is not threadsafe...

This commit is contained in:
nek0 2018-06-10 04:21:00 +02:00
parent ee62010d7f
commit ce48dd505e
2 changed files with 5 additions and 4 deletions

View file

@ -25,7 +25,7 @@ loadLoad = do
ud <- getAffection ud <- getAffection
progress <- liftIO $ newMVar 0 progress <- liftIO $ newMVar 0
future <- liftIO $ newEmptyMVar future <- liftIO $ newEmptyMVar
_ <- liftIO $ forkIO $ loadFork (worldState ud) (nano ud) future progress _ <- liftIO $ loadFork (worldState ud) (nano ud) future progress
putAffection ud putAffection ud
{ stateMVar = future { stateMVar = future
, stateProgress = progress , stateProgress = progress

View file

@ -176,10 +176,11 @@ naviGraph imgmat (V2 r c) =
drawLoadScreen :: UserData -> Float -> IO () drawLoadScreen :: UserData -> Float -> IO ()
drawLoadScreen ud progress = do drawLoadScreen ud progress = do
let ctx = nano ud let ctx = nano ud
-- fontSize ctx 100
-- fontFace ctx (assetFonts ud Map.! FontBedstead)
-- textAlign ctx (S.fromList [AlignCenter, AlignTop])
fillColor ctx (rgb 255 128 0) fillColor ctx (rgb 255 128 0)
fontSize ctx 100
fontFace ctx (assetFonts ud Map.! FontBedstead)
textAlign ctx (S.fromList [AlignCenter, AlignTop])
textBox ctx 0 300 1280 "Loading"
rect ctx rect ctx
(640 - 640 * realToFrac progress) 450 (1280 * realToFrac progress) 20 (640 - 640 * realToFrac progress) 450 (1280 * realToFrac progress) 20
fill ctx fill ctx