Tweak inventory display

This commit is contained in:
2025-12-26 11:05:34 +00:00
parent 2cb9fb153a
commit 2f935a0d41
5 changed files with 71 additions and 58 deletions
+2
View File
@@ -56,6 +56,8 @@ data SIDisplayMod
= NoSIDisplayMod
| HighlightSI
| DropShadowSI
| InventoryHeadSI
| InventoryHeadFilterSI
makeLenses ''LDParams
makeLenses ''SelectionItem
+8 -5
View File
@@ -65,7 +65,7 @@ updateCombineSections w cfig =
sclose'
| null sclose =
IM.singleton 0 $
SelItem ["NONE"] 1 25 False white 2 Nothing NoSIDisplayMod
SelItem ["NONE"] 1 25 False white 2 Nothing DropShadowSI
| otherwise = sclose
regexCombs :: IM.IntMap Item -> SelectionItem CombItem -> String -> Bool
@@ -124,7 +124,7 @@ updateDisplaySections w cfig =
[ sfinv
, sinv
, IM.singleton 0 $
SelItem [displayFreeSlots (crNumFreeSlots (w ^. cWorld . lWorld . items) cr)] 1 15 True invDimColor 2 Nothing NoSIDisplayMod
SelItem [displayFreeSlots (crNumFreeSlots (w ^. cWorld . lWorld . items) cr)] 1 15 True invDimColor 2 Nothing DropShadowSI
, sfclose1
, sclose
, interfaceshead
@@ -147,7 +147,7 @@ updateDisplaySections w cfig =
btitems =
IM.fromDistinctAscList . zip [0 ..] $
mapMaybe (closeButtonToSelectionItem w) (w ^. hud . closeButtons)
makehead str = IM.singleton 0 $ SelItem [str] 1 15 False white 0 Nothing NoSIDisplayMod
makehead str = IM.singleton 0 $ SelItem [str] 1 15 False white 0 Nothing InventoryHeadSI
cr = you w
closeitms =
IM.fromDistinctAscList . zip [0 ..] $
@@ -168,7 +168,7 @@ filterSectionsPair infocus filtfn itms s mfilt = (x, itms')
where
filtcurs = if infocus then cFilledRect else cWireRect
x = IM.singleton 0 $
fromMaybe (SelItem [s] 1 (length s) False white 0 Nothing NoSIDisplayMod) $ do
fromMaybe (SelItem [s] 1 (length s) False white 0 Nothing InventoryHeadSI) $ do
str <- mfilt
return $
SelItem
@@ -179,7 +179,7 @@ filterSectionsPair infocus filtfn itms s mfilt = (x, itms')
white
0
Nothing
NoSIDisplayMod
InventoryHeadFilterSI
f y = y
-- | null y =
-- IM.singleton 0 $ SelItem ["(NONE)"] 1 (length s) True (greyN 0.5) 0 Nothing
@@ -303,6 +303,9 @@ listSelectionColorPicture si = (g <$> _siPictures si, Sum $ _siHeight si)
NoSIDisplayMod -> docolor . text
HighlightSI -> docolor . hackBoldText
DropShadowSI -> hackDropShadow (si ^. siColor) black
InventoryHeadSI -> hackInvertText black white . dopad
InventoryHeadFilterSI -> docolor . text
dopad s = " "<>s<>" "
docolor = color (si ^. siColor)
lindent = 100 * fromIntegral (_siOffX si)
+2 -2
View File
@@ -221,7 +221,7 @@ closeItemToSelectionItem w i = do
, _siColor = col
, _siOffX = 0
, _siPayload = Nothing
, _siDisplayMod = NoSIDisplayMod
, _siDisplayMod = DropShadowSI
}
closeButtonToSelectionItem :: World -> Int -> Maybe (SelectionItem ())
@@ -236,7 +236,7 @@ closeButtonToSelectionItem w i = do
, _siColor = yellow
, _siOffX = 0
, _siPayload = Nothing
, _siDisplayMod = NoSIDisplayMod
, _siDisplayMod = DropShadowSI
}
btText :: Button -> String
+5
View File
@@ -27,6 +27,7 @@ module Picture.Base (
text,
hackBoldText,
hackDropShadow,
hackInvertText,
textRight,
textJustifyLeft,
textJustifyRight,
@@ -196,6 +197,10 @@ text :: String -> Picture
{-# INLINE text #-}
text = drawText 0
hackInvertText :: Color -> Color -> String -> Picture
hackInvertText c1 c2 s = color c2 (polygon $ rectNSWE 200 0 0 (fromIntegral (length s) * 100))
<> color c1 (text s)
hackBoldText :: String -> Picture
hackBoldText s = text s <> translate 10 0 (text s)