Add creature info display

This commit is contained in:
2022-04-10 23:07:11 +01:00
parent 0cc12f31ad
commit 12852a7670
5 changed files with 47 additions and 29 deletions
+12 -2
View File
@@ -7,12 +7,22 @@ import Dodge.Render.List
import Dodge.Base
import Picture
import Geometry
--import qualified Control.Foldl as L
--import Control.Monad
--import Data.Maybe
renderInfoListAt :: Float -> Float -> Configuration -> World -> (Point2,[String]) -> Picture
renderInfoListAt x y cfig w (p,ss) = renderListAt x y cfig (zip ss (repeat white))
<> winScale cfig (color yellow $ zConnect (V2 (20+x-hw) (y+hh-20)) (worldPosToScreen w p))
renderInfoListAt x y cfig w (p,ss) = renderListAt x y cfig (zip ss (repeat yellow))
<> winScale cfig (color yellow $ lConnect (V2 (x-hw) (hh-20-y)) (worldPosToScreen w p))
where
hw = halfWidth cfig
hh = halfHeight cfig
renderInfoListsAt :: Float -> Float -> Configuration -> World -> [(Point2,[String])] -> Picture
renderInfoListsAt x y cfig w =
fst . foldr f (mempty,0)
where
f (p,ss) (pic,offset) = (pic <> renderInfoListAt x (y + offset) cfig w (p,ss)
, offset + 20 * fromIntegral (length ss)
)