Tweak drawing order, text now blocks window shadows

This commit is contained in:
2021-02-24 23:08:20 +01:00
parent 8a4169653f
commit 1969aa4f4a
6 changed files with 28 additions and 19 deletions
+8 -6
View File
@@ -173,7 +173,7 @@ drawCursor :: World -> Picture
drawCursor w = translate (105-halfWidth w)
(halfHeight w - (25* (fromIntegral iPos)) - 20
)
$ setLayer 2
$ setLayer 1
$ line [(200,12.5),(-100,12.5),(-100,-12.5),(200,-12.5)]
where iPos = _crInvSel $ _creatures w IM.! _yourID w
@@ -340,17 +340,19 @@ lineOnScreen w (p1:p2:_) = errorPointInPolygon 8 p1 sp || errorPointInPolygon 9
drawWallShadow :: World -> Wall -> Drawing
drawWallShadow w wall
| isRHS sightFrom x y = blank
| otherwise = onLayerL l $ color shadCol $ polygon $ points
-- | otherwise = onLayerL l $ color shadCol $ polygon $ points
| otherwise = colorAndLayer $ polygon $ points
where
l | _wlIsSeeThrough wall = [levLayer ShadowLayer]
| otherwise = [levLayer ShadowLayer, 0]
colorAndLayer | _wlIsSeeThrough wall = setLayer 2
. onLayerL [levLayer ShadowLayer]
. color (withAlpha 0.2 $ _wlColor wall)
| otherwise = onLayerL [levLayer ShadowLayer,2]
. color black
(x:y:_) = _wlLine wall
ps = linePointsBetween x y
ds = map (\p -> safeNormalizeV (p -.- sightFrom)) ps
p's = zipWith (\d x -> (15 *.* d) +.+ x) ds ps
sightFrom = _cameraCenter w
shadCol = if _wlIsSeeThrough wall then withAlpha 0.2 $ _wlColor wall
else black
corns = screenPolygon w
borders = filter g $ zip corns (tail corns ++ [head corns])
g (a,b) = isLHS a b sightFrom