reduce liftIO calls

This commit is contained in:
nek0 2018-05-15 19:27:54 +02:00
parent 8a620f742e
commit 1f1bdd216a
2 changed files with 13 additions and 13 deletions

View file

@ -25,15 +25,15 @@ import Types.ReachPoint
drawNPCs
:: Context
-> UserData
-> [V2 Double]
-> Double
-> Double
-> Int
-> Int
-> Maybe ImgId
-> Affection UserData ()
drawNPCs ctx npcposs prow pcol row col img = do
ud <- getAffection
-> IO ()
drawNPCs ctx ud npcposs prow pcol row col img = do
let fnpcposs = filter
(\(V2 nr nc) ->
let x = realToFrac $ 640 + ((nc - pcol) + (nr - prow)) * 32
@ -47,7 +47,7 @@ drawNPCs ctx npcposs prow pcol row col img = do
(floor nr == row && floor nc == col)
)
npcposs
liftIO $ mapM_
mapM_
(\(V2 nr nc) -> do
let x = realToFrac $ 640 + ((nc - pcol) + (nr - prow)) * 32
y = realToFrac $ 360 + ((nr - prow) - (nc - pcol)) * 16

View file

@ -163,13 +163,13 @@ drawMap = do
fill ctx
mapM_ (\(i, ls) -> mapM_
(\(j, t) -> do
liftIO $ drawTile
drawTile
(assetImages ud) ctx pr pc i j t
drawNPCs ctx npcposs pr pc i j t
drawNPCs ctx ud npcposs pr pc i j t
)
(reverse $ zip [1..] ls))
(zip [1..] (toLists mat))
liftIO $ do -- draw FPS
-- liftIO $ do -- draw FPS
fontSize ctx 20
fontFace ctx (assetFonts ud Map.! FontBedstead)
textAlign ctx (S.fromList [AlignCenter,AlignTop])