Improve inventory display

This commit is contained in:
2024-10-26 10:53:36 +01:00
parent ae0f2fad0f
commit e2f3d6a378
9 changed files with 280 additions and 249 deletions
+12 -11
View File
@@ -59,13 +59,15 @@ drawHP cfig =
drawInventory :: IM.IntMap (SelectionSection ()) -> World -> Configuration -> Picture
drawInventory sss w cfig =
drawSelectionSections sss ldp cfig
<> drawSSCursor sss (w ^? hud . hudElement . diSelection . _Just) ldp curs cfig
-- <> drawSSCursor sss (w ^? hud . hudElement . diSelection . _Just) ldp curs cfig
<> drawSSMultiCursor sss (w ^? hud . hudElement . diSelection . _Just)
(w ^? hud . hudElement . diSelectionExtra)
ldp curs cfig
<> iextra
<> translateScreenPos
cfig
(ldp ^. ldpPos)
(drawDIMouseOver w)
<> drawDISelections w cfig
(drawDIMouseOver w <> drawDISelections w)
<> drawDISelections' w cfig
where
ldp = invDisplayParams w
@@ -82,9 +84,9 @@ drawDIMouseOver w = fromMaybe mempty $ do
(_, i) <- w ^? hud . hudElement . subInventory . nsMouseOver . _Just
sss <- w ^? hud . hudElement . diSections
let idp = invDisplayParams w
return . color (withAlpha 0.5 white) $ selSecDrawCursorAt 10 idp curs sss (0, i)
return . color (withAlpha 0.2 white) $ selSecDrawCursorAt 15 idp curs sss (0, i)
where
curs = BoundaryCursor [North, South]
curs = BackdropCursor
getMouseInvSel :: World -> Maybe ((Int, Int), (Int, Int))
getMouseInvSel w = case w ^? hud . hudElement . subInventory . nsSelected of
@@ -97,14 +99,13 @@ getMouseInvSel' w = do
(i, j) <- w ^? hud . hudElement . diSelection . _Just
return ((i, j), (i, j + x))
drawDISelections :: World -> Configuration -> Picture
drawDISelections w cfig = fromMaybe mempty $ do
((i, j), (a, b)) <- getMouseInvSel w
drawDISelections :: World -> Picture
drawDISelections w = fromMaybe mempty $ do
((_, j), (_, b)) <- getMouseInvSel w
sss <- w ^? hud . hudElement . diSections
let idp = invDisplayParams w
tp <- selNumPosCardinal NorthWest8 cfig idp sss i j
bp <- selNumPosCardinal SouthWest8 cfig idp sss a b
return . color red . line $ sort [tp, bp]
let f x = selSecDrawCursorAt 15 idp BackdropCursor sss (0,x)
return . color (withAlpha 0.2 white) . foldMap f $ [min j b..max j b]
drawDISelections' :: World -> Configuration -> Picture
drawDISelections' w cfig = fromMaybe mempty $ do