fix drawing order

This commit is contained in:
nek0 2018-06-03 20:14:29 +02:00
parent 03b84b02db
commit bf0cd44f56

View file

@ -212,8 +212,7 @@ drawTile ud ctx posanims pr pc row col img =
((realToFrac x :: Double) < 1280 && ((realToFrac x :: Double) < 1280 &&
(realToFrac (y - (74 - (realToFrac tileHeight :: CFloat))) :: Double) < 720)) $ (realToFrac (y - (74 - (realToFrac tileHeight :: CFloat))) :: Double) < 720)) $
do do
let (lt, ge) = L.partition delimiter filtered let (lt, ge) = L.partition delimiter sorted
-- ge = Prelude.filter (not . delimiter) sorted
save ctx save ctx
mapM_ drawAnim lt mapM_ drawAnim lt
when (isJust img) drawImage when (isJust img) drawImage
@ -227,10 +226,7 @@ drawTile ud ctx posanims pr pc row col img =
anims = assetAnimations ud anims = assetAnimations ud
tileWidth = 64 :: Double tileWidth = 64 :: Double
tileHeight = 32 :: Double tileHeight = 32 :: Double
filtered = Prelude.filter sorted = sortOn (\(V2 sr sc, _) -> sc + sr * fromIntegral col) posanims
(\(V2 ar ac, _) -> floor ar == row && floor ac == col) posanims
sorted = sortOn (\(V2 sr sc, _) -> sc + sr * maxCol) filtered
maxCol = maximum (Prelude.map (\(V2 _ mc, _) -> mc) filtered)
minrs = Prelude.map (fst . matmin) mb minrs = Prelude.map (fst . matmin) mb
maxrs = Prelude.map (fst . matmax) mb maxrs = Prelude.map (fst . matmax) mb
mincs = Prelude.map (snd . matmin) mb mincs = Prelude.map (snd . matmin) mb