From 5b911ab3ec8be0e6e2498e3ac593093646301fe3 Mon Sep 17 00:00:00 2001 From: nek0 Date: Sat, 16 Jun 2018 11:40:51 +0200 Subject: [PATCH] fix draw ordering --- src/Test.hs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Test.hs b/src/Test.hs index 6b9c8f2..0176d92 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -238,16 +238,27 @@ drawTile ud ctx posanims pr pc row col img = ((realToFrac x :: Double) < 1280 && (realToFrac (y - (74 - (realToFrac tileHeight :: CFloat))) :: Double) < 720)) $ do - let (lt, ge) = L.partition delimiter sorted + let (bef, beh) = L.partition delimiter posanims save ctx - mapM_ drawAnim lt + mapM_ drawAnim beh when (isJust img) drawImage - mapM_ drawAnim ge + mapM_ drawAnim bef restore ctx where delimiter (V2 nr nc, _) = - any (\m -> nr < fromIntegral (floor nr :: Int) + m) maxrs && - any (\m -> nc > fromIntegral (floor nc :: Int) + m) mincs + all delimit mb + where + delimit b + | nnr > fst (matmin b) && nnr < fst (matmax b) = + nnc < snd (matmin b) + | nnc > snd (matmin b) && nnc < snd (matmax b) = + nnr > fst (matmax b) + | otherwise = + True + nnr = nr - fromIntegral (floor nr) + nnc = nc - fromIntegral (floor nc) + -- any (\m -> nr < fromIntegral (floor nr :: Int) + m) maxrs && + -- any (\m -> nc > fromIntegral (floor nc :: Int) + m) mincs ai = assetImages ud anims = assetAnimations ud tileWidth = 64 :: Double