Continue tweaking inventory display

This commit is contained in:
2024-10-26 14:50:35 +01:00
parent e2f3d6a378
commit 6402ab11da
2 changed files with 10 additions and 23 deletions
+1 -1
View File
@@ -1 +1 @@
All good (594 modules, at 10:51:47)
All good (594 modules, at 14:50:27)
+9 -22
View File
@@ -8,7 +8,6 @@ module Dodge.Render.HUD (
import Control.Lens
import Control.Monad
import Data.List (sort)
import qualified Data.Map.Strict as M
import Data.Maybe
import qualified Data.Vector as V
@@ -59,16 +58,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
<> drawSSMultiCursor sss (w ^? hud . hudElement . diSelection . _Just)
(w ^? hud . hudElement . diSelectionExtra)
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)
<> drawDISelections' w cfig
where
ldp = invDisplayParams w
curs = invCursorParams w
@@ -91,13 +89,11 @@ drawDIMouseOver w = fromMaybe mempty $ do
getMouseInvSel :: World -> Maybe ((Int, Int), (Int, Int))
getMouseInvSel w = case w ^? hud . hudElement . subInventory . nsSelected of
Just (MouseInvSelect s (Just e)) -> Just (s, e)
_ -> Nothing
getMouseInvSel' :: World -> Maybe ((Int, Int), (Int, Int))
getMouseInvSel' w = do
x <- w ^? hud . hudElement . diSelectionExtra
(i, j) <- w ^? hud . hudElement . diSelection . _Just
return ((i, j), (i, j + x))
_ -> case w ^? hud . hudElement . diSelectionExtra of
Just x | x > 0 -> do
(i,j) <- w ^? hud . hudElement . diSelection . _Just
return ((i,j),(i,j+x))
_ -> Nothing
drawDISelections :: World -> Picture
drawDISelections w = fromMaybe mempty $ do
@@ -107,15 +103,6 @@ drawDISelections w = fromMaybe mempty $ do
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
((i, j), (a, b)) <- getMouseInvSel' w
sss <- w ^? hud . hudElement . diSections
let idp = invDisplayParams w
tp <- selNumPosCardinal NorthEast8 cfig idp sss i j
bp <- selNumPosCardinal SouthEast8 cfig idp sss a b
return . color green . line $ sort [tp, bp]
drawSubInventory :: SubInventory -> Configuration -> World -> Picture
drawSubInventory subinv cfig w = case subinv of
LockedInventory -> mempty -- topInvCursor col cursPos cfig w