From 6402ab11dadca52a877c03610f9e7a30dce0fe01 Mon Sep 17 00:00:00 2001 From: justin Date: Sat, 26 Oct 2024 14:50:35 +0100 Subject: [PATCH] Continue tweaking inventory display --- ghcidOutput | 2 +- src/Dodge/Render/HUD.hs | 31 +++++++++---------------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/ghcidOutput b/ghcidOutput index 571aa75c1..b9e92aec0 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1 +1 @@ -All good (594 modules, at 10:51:47) +All good (594 modules, at 14:50:27) diff --git a/src/Dodge/Render/HUD.hs b/src/Dodge/Render/HUD.hs index ac723cfc1..bd982bd33 100644 --- a/src/Dodge/Render/HUD.hs +++ b/src/Dodge/Render/HUD.hs @@ -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