Fix bug in detecting which room you are in
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
module Dodge.Render.List
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.Base.Window
|
||||
import Picture
|
||||
|
||||
renderListAt :: Float -> Float -> World -> [(String,Color)] -> Picture
|
||||
renderListAt tx ty w =
|
||||
concatMapPic (winScale w) . zipWith (listPairAt tx ty w) [0..]
|
||||
|
||||
listPairAt
|
||||
:: Float -- ^ x offset
|
||||
-> Float -- ^ y offset
|
||||
-> World
|
||||
-> Int -- ^ y offset (discrete)
|
||||
-> (String,Color) -- ^ The text item
|
||||
-> Picture
|
||||
{-# INLINE listPairAt #-}
|
||||
listPairAt xoff yoff w yint (s,col)
|
||||
= translate (xoff + 15 - halfWidth w) (yoff + halfHeight w - (20 * (fromIntegral yint+1)))
|
||||
. scale 0.1 0.1
|
||||
. dShadCol col
|
||||
$ text s
|
||||
{- | Colour picture and add black drop shadow. -}
|
||||
dShadCol :: Color -> Picture -> Picture
|
||||
dShadCol c p = pictures
|
||||
[ color black $ translate 1.2 (-1.2) p
|
||||
, color c p
|
||||
]
|
||||
winScale :: World -> Picture -> Picture
|
||||
{-# INLINE winScale #-}
|
||||
winScale w = scale (2 / getWindowX w) (2 / getWindowY w)
|
||||
Reference in New Issue
Block a user