38 lines
1.0 KiB
Haskell
38 lines
1.0 KiB
Haskell
module Dodge.Render.List
|
|
( renderListAt
|
|
, dShadCol
|
|
, winScale
|
|
)
|
|
where
|
|
import Dodge.Data
|
|
import Dodge.Base.Window
|
|
import Dodge.WinScale
|
|
import Picture
|
|
|
|
renderListAt :: Float -> Float -> Configuration -> World -> [(String,Color)] -> Picture
|
|
renderListAt tx ty cfig w =
|
|
concatMapPic (winScale cfig) . zipWith (listPairAt tx ty cfig w) [0..]
|
|
|
|
listPairAt
|
|
:: Float -- ^ x offset
|
|
-> Float -- ^ y offset
|
|
-> Configuration
|
|
-> World
|
|
-> Int -- ^ y offset (discrete)
|
|
-> (String,Color) -- ^ The text item
|
|
-> Picture
|
|
{-# INLINE listPairAt #-}
|
|
listPairAt xoff yoff cfig w yint (s,col)
|
|
= translate (xoff + 15 - halfWidth cfig) (yoff + halfHeight cfig - (20 * (fromIntegral yint+1)))
|
|
. scale 0.1 0.1
|
|
. dShadCol col
|
|
$ text s
|
|
--TODO put the following functions in an appropriate place
|
|
{- | Colour picture and add black drop shadow. -}
|
|
dShadCol :: Color -> Picture -> Picture
|
|
{-# INLINE dShadCol #-}
|
|
dShadCol c p = pictures
|
|
[ color black $ translate 1.2 (-1.2) p
|
|
, color c p
|
|
]
|