Start adding mouse control of inventory

This commit is contained in:
2024-10-15 23:26:08 +01:00
parent e745238b8f
commit cf0873d73b
18 changed files with 333 additions and 269 deletions
+8 -3
View File
@@ -10,6 +10,7 @@ module Dodge.Render.List (
stackPicturesAt,
toTopLeft,
listCursorChooseBorderScale,
selSecDrawCursorAt,
) where
import Dodge.SelectionSections
@@ -84,9 +85,8 @@ stackPicturesAt = stackPicturesAtOff 0
stackPicturesAtOff :: Int -> [Picture] -> Picture
stackPicturesAtOff i = mconcat . zipWith (drawListElement 10 1 0) [i, i -1 ..]
selSecDrawCursor :: Int -> ListDisplayParams -> SelectionSections a -> Picture
selSecDrawCursor xsize ldp sss = fromMaybe mempty $ do
(i, j) <- sss ^? sssExtra . sssSelPos . _Just
selSecDrawCursorAt :: (Int,Int) -> Int -> ListDisplayParams -> SelectionSections a -> Picture
selSecDrawCursorAt (i,j) xsize ldp sss = fromMaybe mempty $ do
yint <- selSecYint i j sss
xint <- sss ^? sssSections . ix i . ssIndent
si <- sss ^? sssSections . ix i . ssItems . ix j
@@ -101,6 +101,11 @@ selSecDrawCursor xsize ldp sss = fromMaybe mempty $ do
xsize
(_siHeight si)
selSecDrawCursor :: Int -> ListDisplayParams -> SelectionSections a -> Picture
selSecDrawCursor xsize ldp sss = maybe mempty
(\x -> selSecDrawCursorAt x xsize ldp sss)
(sss ^? sssExtra . sssSelPos . _Just)
-- displays a cursor that should match up to list text pictures
listCursorChooseBorderScale ::
Float ->