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