Implement telescoping inventory selection
This commit is contained in:
@@ -60,7 +60,7 @@ drawCursorAt ldps cfig mi lis = fromMaybe mempty $ do
|
||||
NoCursor -> Nothing
|
||||
let j = sum . map _siHeight $ take i lis
|
||||
col = _siColor selit
|
||||
return $ f (_ldpPosX ldps + (9 * fromIntegral (_siOffX selit))) (_ldpPosY ldps) cfig j col wdth (_siHeight selit)
|
||||
return $ f (_ldpPosX ldps + (9 * fromIntegral (_siOffX selit))) (_ldpPosY ldps) cfig j 0 col wdth (_siHeight selit)
|
||||
where
|
||||
wdth = case _ldpWidth ldps of
|
||||
FixedSelectionWidth x -> x
|
||||
@@ -74,7 +74,7 @@ drawCursorAt' ldps cfig i lis = fromMaybe mempty $ do
|
||||
NoCursor -> Nothing
|
||||
let j = getIthPos i lis
|
||||
col = _siColor selit
|
||||
return $ f (_ldpPosX ldps + (9 * fromIntegral (_siOffX selit))) (_ldpPosY ldps) cfig j col wdth (_siHeight selit)
|
||||
return $ f (_ldpPosX ldps + (9 * fromIntegral (_siOffX selit))) (_ldpPosY ldps) cfig j 0 col wdth (_siHeight selit)
|
||||
where
|
||||
wdth = case _ldpWidth ldps of
|
||||
FixedSelectionWidth x -> x
|
||||
@@ -109,6 +109,24 @@ stackPicturesAt tx ty cfig = stackPicturesAtOff tx ty cfig 0
|
||||
stackPicturesAtOff :: Float -> Float -> Configuration -> Int -> [Picture] -> Picture
|
||||
stackPicturesAtOff tx ty cfig i = mconcat . zipWith (listTextPictureAt tx ty cfig) [i, i -1 ..]
|
||||
|
||||
listCursorDisplayParams ::
|
||||
ListDisplayParams ->
|
||||
[CardinalPoint] ->
|
||||
Configuration ->
|
||||
Int ->
|
||||
Int ->
|
||||
Color ->
|
||||
Int ->
|
||||
Int ->
|
||||
Picture
|
||||
listCursorDisplayParams ldp borders cfig yint xint col cursxsize cursysize =
|
||||
listCursorChooseBorderScale ygap s borders xoff yoff cfig yint xint col cursxsize cursysize
|
||||
where
|
||||
ygap = _ldpVerticalGap ldp
|
||||
s = _ldpScale ldp
|
||||
xoff = _ldpPosX ldp
|
||||
yoff = _ldpPosY ldp
|
||||
|
||||
-- displays a cursor that should match up to list text pictures
|
||||
-- the width of a character appears to be 9(?!)
|
||||
-- this is probably because it is 8 pixels plus one for the border
|
||||
@@ -120,14 +138,15 @@ listCursorChooseBorderScale ::
|
||||
Float ->
|
||||
Configuration ->
|
||||
Int ->
|
||||
Int ->
|
||||
Color ->
|
||||
Int ->
|
||||
Int ->
|
||||
Picture
|
||||
listCursorChooseBorderScale ygap s borders xoff yoff cfig yint col cursxsize cursysize =
|
||||
listCursorChooseBorderScale ygap s borders xoff yoff cfig yint xint col cursxsize cursysize =
|
||||
winScale cfig
|
||||
. translate
|
||||
(15 - (9 * s) + xoff - halfWidth cfig)
|
||||
(15 + (9 * s * (fromIntegral xint - 1)) + xoff - halfWidth cfig)
|
||||
(halfHeight cfig + s * 12.5 - (yoff + (s * 10 + ygap) * (fromIntegral yint + 1)))
|
||||
. color col
|
||||
$ chooseCursorBorders (s * wth) (s * hgt) borders
|
||||
@@ -140,7 +159,7 @@ listCursorChooseBorderScale ygap s borders xoff yoff cfig yint col cursxsize cur
|
||||
-- the width of a character appears to be 9(?!)
|
||||
-- this is probably because it is 8 pixels plus one for the border
|
||||
listCursorChooseBorder ::
|
||||
[CardinalPoint] -> Float -> Float -> Configuration -> Int -> Color -> Int -> Int -> Picture
|
||||
[CardinalPoint] -> Float -> Float -> Configuration -> Int -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorChooseBorder = listCursorChooseBorderScale 10 1
|
||||
|
||||
-- note we cannot simply scale lines because they are drawn as solid rectangles
|
||||
@@ -155,16 +174,16 @@ chooseCursorBorders wth hgt = foldMap (line . toLine)
|
||||
toLine South = [V2 wth bot, V2 lef bot]
|
||||
toLine West = [V2 lef bot, V2 lef top]
|
||||
|
||||
listCursorNS :: Float -> Float -> Configuration -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorNS :: Float -> Float -> Configuration -> Int -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorNS = listCursorChooseBorder [North, South]
|
||||
|
||||
listCursorNES :: Float -> Float -> Configuration -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorNES :: Float -> Float -> Configuration -> Int -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorNES = listCursorChooseBorder [North, South, East]
|
||||
|
||||
listCursorNESW :: Float -> Float -> Configuration -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorNESW :: Float -> Float -> Configuration -> Int -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorNESW = listCursorChooseBorder [North, South, East, West]
|
||||
|
||||
listCursorNSW :: Float -> Float -> Configuration -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorNSW :: Float -> Float -> Configuration -> Int -> Int -> Color -> Int -> Int -> Picture
|
||||
listCursorNSW = listCursorChooseBorder [North, South, West]
|
||||
|
||||
fillScreenText :: Configuration -> String -> Picture
|
||||
|
||||
Reference in New Issue
Block a user