Keep inventory as intmap, start to allow items of different sizes
This commit is contained in:
@@ -1,13 +1,45 @@
|
||||
module Dodge.Render.List
|
||||
( renderListAt
|
||||
, dShadCol
|
||||
, winScale
|
||||
)
|
||||
where
|
||||
module Dodge.Render.List where
|
||||
import Dodge.Data
|
||||
import Dodge.Base.Window
|
||||
import Dodge.WinScale
|
||||
import Picture
|
||||
import Geometry
|
||||
|
||||
-- given a list of pictures that are each the size of a "text" call, displays them as
|
||||
-- a list on the screen
|
||||
listTextPicturesAt :: Float -> Float -> Configuration -> [Picture] -> Picture
|
||||
listTextPicturesAt tx ty cfig = mconcat . zipWith (listTextPictureAt tx ty cfig) [0..]
|
||||
|
||||
-- displays a cursor that should match up to list text pictures
|
||||
-- the width of a character appears to be 9(?!)
|
||||
listCursorAt :: Float -> Float -> Configuration -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorAt xoff yoff cfig yint col cursxsize cursysize = winScale cfig
|
||||
. translate (10.5+xoff-halfWidth cfig) (halfHeight cfig - (20* fromIntegral yint + yoff) - 20)
|
||||
$ lineCol
|
||||
[(V2 0 12.5 , col)
|
||||
,(V2 wth 12.5 ,col)
|
||||
] <>
|
||||
lineCol
|
||||
[(V2 0 (12.5 - hgt),col)
|
||||
,(V2 wth (12.5 - hgt),col)
|
||||
]
|
||||
--[(V2 wth 12.5 ,withAlpha 0 col)
|
||||
--,(V2 0 12.5 ,col)
|
||||
--,(V2 0 (12.5 - hgt),col)
|
||||
--,(V2 wth (12.5 - hgt),withAlpha 0 col)
|
||||
--]
|
||||
where
|
||||
x = 9
|
||||
wth = x * fromIntegral cursxsize
|
||||
hgt = 20 * fromIntegral cursysize
|
||||
|
||||
listTextPictureAt :: Float -> Float -> Configuration -> Int -> Picture -> Picture
|
||||
listTextPictureAt xoff yoff cfig yint = winScale cfig
|
||||
. translate (xoff + 15 - hw) (yoff + hh - (20 * (fromIntegral yint+1)))
|
||||
. scale 0.1 0.1
|
||||
where
|
||||
hw = halfWidth cfig
|
||||
hh = halfHeight cfig
|
||||
|
||||
renderListAt :: Float -> Float -> Configuration -> [(String,Color)] -> Picture
|
||||
renderListAt tx ty cfig =
|
||||
|
||||
Reference in New Issue
Block a user