Improve inventory rendering

This commit is contained in:
jgk
2021-03-07 23:55:09 +01:00
parent f92075263f
commit c9ae76594b
2 changed files with 6 additions and 21 deletions
+5 -20
View File
@@ -432,12 +432,12 @@ linePointsBetween p p' | d > 99 = map (\m -> p +.+ fromIntegral m *.* p'') [0..n
p'' = (1/fromIntegral n) *.* (p' -.- p)
displayInv :: Int -> World -> Picture
displayInv n w = pictures $ zipWith (translate (10-halfWidth w))
displayInv n w = pictures $ zipWith (translate (15-halfWidth w))
(map (\x-> halfHeight w-(25*(fromIntegral x+1))) ns) $ map dItem' is
where (ns,is) = unzip $ IM.toList $ _crInv $ _creatures w IM.! n
dItem' NoItem = scale 0.1 0.1 $ dShadCol (greyN 0.5) $ text "----"
dItem' i = scale 0.1 0.1 $ pictures [dropShadow t, color (_itInvColor i) t]
dItem' i = scale 0.1 0.1 $ dShadCol (_itInvColor i) t
where t = text $ _itInvDisplay i i
displayAmount :: Int -> String
@@ -504,25 +504,10 @@ ringPict = onLayer LabelLayer $ dShadCol white $ pictures [line [(-8,10),(-15,10
dShadCol :: Color -> Picture -> Picture
dShadCol c p = pictures $
map (flip (uncurry translate) p) [--(0.2,-0.2)
--,(0.4,-0.4)
--,(0.6,-0.6)
--,(0.8,-0.8)
--,( 1,- 1)
(1.2,-1.2)
] ++ [color c p]
[ color black $ uncurry translate (1.2,-1.2) p
, color c p
]
dropShadow :: Picture -> Picture
dropShadow p = pictures [ translate 5 (-5) p
, translate 1 (-1) p
, translate 2 (-2) p
, translate 3 (-3) p
, translate 4 (-4) p
, translate 6 (-6) p
, translate 7 (-7) p
, translate 8 (-8) p
, translate 9 (-9) p
]
ffToDraw :: World -> [ForceField]
ffToDraw w = filter (lineOnScreen w . _ffLine) $
+1 -1
View File
@@ -331,7 +331,7 @@ tractorGun = autoGun
, _itEquipPict = drawWeapon $ color blue $ pictures [polygon $ rectNESW 1.5 6 (-1.5) 0 ]
}
launcher = defaultGun
{ _itName = "lAUNCHER"
{ _itName = "LAUNCHER"
, _itIdentity = Launcher
, _wpMaxAmmo = 30
, _wpLoadedAmmo = 30