This commit is contained in:
2023-01-16 00:16:12 +00:00
parent 048135c370
commit bb72ec9baa
6 changed files with 45 additions and 60 deletions
+9 -7
View File
@@ -3,6 +3,8 @@ module Dodge.Render.HUD (
drawHUD,
) where
import SelectionIntMap
import Dodge.Data.Combine
import Dodge.Default.SelectionList
import Dodge.Combine
import Dodge.Creature.Info
@@ -90,7 +92,7 @@ drawSubInventory subinv cfig w = case subinv of
cfig
("COMBINE")
sl
<> combineInventoryExtra mi cfig w
<> combineInventoryExtra sl mi cfig w
titledSub :: Configuration -> String -> SelectionList a -> Picture
titledSub cfig subtitle subitems =
@@ -180,20 +182,20 @@ examineInventoryExtra mtweaki mitm cfig =
-- , drawSelectionList thirdColumnParams cfig (thirdColumnPara (itmInfo mitm))
]
combineInventoryExtra :: Maybe Int -> Configuration -> World -> Picture
combineInventoryExtra mi cfig w =
combineInventoryExtra :: SelectionIntMap CombinableItem -> Maybe Int -> Configuration -> World -> Picture
combineInventoryExtra sm mi cfig w =
pictures
[ fromMaybe mempty $ do
i <- mi
cpos <- combinePoss w !? i
col <- (combineItemListYou w !? i) <&> _itInvColor . snd
let cpos = getIthPos i (sm ^. smShownItems)
col <- sm ^? smShownItems . ix i . siColor
return $
pictures
[ fromMaybe mempty $ do
strs <- fmap (fst . snd) (combineListInfo w !? i)
strs <- sm ^? smShownItems . ix i . siPayload . ciInfo
return $ listPicturesAtOff (subInvX + 150) 60 cfig cpos $ map (color red . text) strs
, fromMaybe mempty $ do
lnks <- map fst (combineItemListYou w) !? i
lnks <- sm ^? smShownItems . ix i . siPayload . ciInvIDs
return $
lnkMidPosInvSelsCol cfig w cpos col lnks
<> foldMap (topCursorTypeWidth listCursorNESW (topInvW + 2) cfig w) lnks
+15
View File
@@ -1,5 +1,6 @@
module Dodge.Render.List where
import SelectionIntMap
import qualified Data.IntMap.Strict as IM
--import Data.Foldable
import Dodge.SelectionList
@@ -63,6 +64,20 @@ drawCursorAt ldps cfig mi lis = fromMaybe mempty $ do
FixedSelectionWidth x -> x
_ -> 1
drawCursorAt' :: ListDisplayParams -> Configuration -> Int -> IM.IntMap (SelectionItem a) -> Picture
drawCursorAt' ldps cfig i lis = fromMaybe mempty $ do
selit <- lis IM.!? i
f <- case _ldpCursorType ldps of
BorderCursor cps -> Just $ listCursorChooseBorderScale (_ldpVerticalGap ldps) (_ldpScale ldps) cps
NoCursor -> Nothing
let j = getIthPos i lis
col = _siColor selit
return $ f (_ldpPosX ldps + (9 * fromIntegral (_siOffX selit))) (_ldpPosY ldps) cfig j col wdth (_siHeight selit)
where
wdth = case _ldpWidth ldps of
FixedSelectionWidth x -> x
_ -> 1
drawSelectionMapCursor :: ListDisplayParams -> Configuration -> SelectionIntMap a -> Picture
drawSelectionMapCursor ldps cfig sl = drawCursorAt ldps cfig (sl ^. smSelPos) (IM.elems $ _smShownItems sl)