From ce48dd505e94c44b0ee2b5ae3ccd24084a4e5fd9 Mon Sep 17 00:00:00 2001 From: nek0 Date: Sun, 10 Jun 2018 04:21:00 +0200 Subject: [PATCH] nanovg is not threadsafe... --- src/Load.hs | 2 +- src/Util.hs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Load.hs b/src/Load.hs index d4a574e..59f0406 100644 --- a/src/Load.hs +++ b/src/Load.hs @@ -25,7 +25,7 @@ loadLoad = do ud <- getAffection progress <- liftIO $ newMVar 0 future <- liftIO $ newEmptyMVar - _ <- liftIO $ forkIO $ loadFork (worldState ud) (nano ud) future progress + _ <- liftIO $ loadFork (worldState ud) (nano ud) future progress putAffection ud { stateMVar = future , stateProgress = progress diff --git a/src/Util.hs b/src/Util.hs index 6a7c911..35b2848 100644 --- a/src/Util.hs +++ b/src/Util.hs @@ -176,10 +176,11 @@ naviGraph imgmat (V2 r c) = drawLoadScreen :: UserData -> Float -> IO () drawLoadScreen ud progress = do 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) + fontSize ctx 100 + fontFace ctx (assetFonts ud Map.! FontBedstead) + textAlign ctx (S.fromList [AlignCenter, AlignTop]) + textBox ctx 0 300 1280 "Loading" rect ctx (640 - 640 * realToFrac progress) 450 (1280 * realToFrac progress) 20 fill ctx