Move configuration from world to universe

This commit is contained in:
2021-11-28 22:30:47 +00:00
parent 45ba120796
commit 8c5777a1af
29 changed files with 343 additions and 300 deletions
+7 -8
View File
@@ -6,22 +6,24 @@ module Dodge.Render.List
where
import Dodge.Data
import Dodge.Base.Window
import Dodge.WinScale
import Picture
renderListAt :: Float -> Float -> World -> [(String,Color)] -> Picture
renderListAt tx ty w =
concatMapPic (winScale w) . zipWith (listPairAt tx ty w) [0..]
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 w yint (s,col)
= translate (xoff + 15 - halfWidth w) (yoff + halfHeight w - (20 * (fromIntegral yint+1)))
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
@@ -33,6 +35,3 @@ 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)