prefilter drawing elements
This commit is contained in:
parent
b2e9af5efd
commit
8ec9f9cb6f
1 changed files with 45 additions and 22 deletions
|
@ -615,10 +615,36 @@ drawMap = do
|
|||
closePath ctx
|
||||
fillColor ctx (rgb 255 255 255)
|
||||
fill ctx
|
||||
void $ sequence $ parMap rpar (\(i, ls) -> void $ sequence $ parMap rpar
|
||||
(\(j, t) -> drawTile ud ctx (partposanims M.! (i, j)) pr pc i j t)
|
||||
(reverse $ zip [1..] ls))
|
||||
let coordList = concatMap
|
||||
(\(i, ls) -> Prelude.map
|
||||
(\(j, t) -> ((i, j), t))
|
||||
(reverse $ zip [1..] ls)
|
||||
)
|
||||
(zip [1..] (toLists mat))
|
||||
filterList = Prelude.filter
|
||||
(\((frow, fcol), tile) ->
|
||||
((realToFrac (sx frow fcol) > -tileWidth &&
|
||||
realToFrac (sy frow fcol) > -tileHeight) &&
|
||||
((realToFrac (sx frow fcol) :: Double) < 1280 &&
|
||||
(realToFrac ((sy frow fcol)- (74 - (realToFrac tileHeight :: CFloat))) :: Double) < 720))
|
||||
)
|
||||
coordList
|
||||
!posanimList = Prelude.map
|
||||
(\((row, col), tile) -> ((row, col), tile, partposanims M.! (row, col)))
|
||||
filterList
|
||||
sx row col = realToFrac $ 640 + ((fromIntegral col - pc) +
|
||||
(fromIntegral row - pr)) * (tileWidth / 2) :: CFloat
|
||||
sy row col = realToFrac $ 360 - (tileHeight / 2) + ((fromIntegral row - pr) -
|
||||
(fromIntegral col - pc)) * (tileHeight / 2) :: CFloat
|
||||
void $ sequence $ parMap rpar
|
||||
(\((row, col), tile, posanim) ->
|
||||
drawTile ud ctx posanim pr pc row col tile
|
||||
)
|
||||
posanimList
|
||||
-- void $ sequence $ parMap rpar (\(i, ls) -> void $ sequence $ parMap rpar
|
||||
-- (\(j, t) -> drawTile ud ctx (partposanims M.! (i, j)) pr pc i j t)
|
||||
-- (reverse $ zip [1..] ls))
|
||||
-- (zip [1..] (toLists mat))
|
||||
mapM_ (\(V2 sr sc, pa, perc) -> when pa $ do
|
||||
let lx = realToFrac $ 640 + ((sc - pc) +
|
||||
(sr - pr)) * (tileWidth / 2) :: CFloat
|
||||
|
@ -658,9 +684,6 @@ drawTile
|
|||
-> Maybe ImgId
|
||||
-> IO ()
|
||||
drawTile ud ctx posanims pr pc row col img =
|
||||
when ((realToFrac x > -tileWidth && realToFrac y > -tileHeight) &&
|
||||
((realToFrac x :: Double) < 1280 &&
|
||||
(realToFrac (y - (74 - (realToFrac tileHeight :: CFloat))) :: Double) < 720)) $
|
||||
do
|
||||
let (bef, beh) = L.partition delimiter sorted
|
||||
save ctx
|
||||
|
|
Loading…
Reference in a new issue