diff --git a/src/Test.hs b/src/Test.hs index 93b1a53..9ef4229 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -189,20 +189,17 @@ drawTile ud ctx posanims pr pc row col img = ((realToFrac x :: Double) < 1280 && (realToFrac (y - (74 - (realToFrac tileHeight :: CFloat))) :: Double) < 720)) $ do - let lt = Prelude.filter (\(V2 nr nc, _) -> - (any (\m -> nr < fromIntegral (floor nr :: Int) + m) maxrs && - any (\m -> nc > fromIntegral (floor nc :: Int) + m) maxcs) - ) sorted - ge = Prelude.filter (\(V2 nr nc, _) -> not - (any (\m -> nr < fromIntegral (floor nr :: Int) + m) maxrs && - any (\m -> nc > fromIntegral (floor nc :: Int) + m) maxcs) - ) sorted + let lt = Prelude.filter delimiter sorted + ge = Prelude.filter (not . delimiter) sorted save ctx mapM_ drawAnim lt when (isJust img) drawImage mapM_ drawAnim ge 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) ai = assetImages ud anims = assetAnimations ud tileWidth = 64 :: Double @@ -211,6 +208,7 @@ drawTile ud ctx posanims pr pc row col img = (\(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 maxrs = Prelude.map (fst . matmax) mb mincs = Prelude.map (snd . matmin) mb maxcs = Prelude.map (snd . matmax) mb