Partial inventory display update

This commit is contained in:
2023-01-27 22:47:45 +00:00
parent ce25157738
commit 5f7d662454
6 changed files with 179 additions and 16 deletions
+21 -12
View File
@@ -1,6 +1,7 @@
--{-# LANGUAGE TupleSections #-}
module Dodge.Render.HUD (
drawHUD,
invDisplayParams,
) where
import SelectionIntMap
@@ -39,17 +40,12 @@ drawHUD :: Configuration -> World -> Picture
drawHUD cfig w = case w ^. hud . hudElement of
DisplayCarte -> drawCarte cfig w
DisplayInventory {_diSections = sections, _subInventory = subinv} ->
drawInGameHUD sl cfig w
drawHP cfig w
<> inventoryDisplay sections w cfig
<> drawSubInventory subinv cfig w
where
sl = makeInventorySelectionList w
drawInGameHUD :: SelectionList () -> Configuration -> World -> Picture
drawInGameHUD sl cfig w =
pictures
[ winScale cfig . dShadCol white $ displayHP 0 cfig w
, inventoryDisplay w cfig sl
]
drawHP :: Configuration -> World -> Picture
drawHP cfig w = winScale cfig . dShadCol white $ displayHP 0 cfig w
defaultListDisplayParams :: ListDisplayParams
defaultListDisplayParams =
@@ -76,9 +72,22 @@ invDisplayParams w =
Just ExamineInventory{} -> True
_ -> False
inventoryDisplay :: World -> Configuration -> SelectionList () -> Picture
inventoryDisplay = drawSelectionList . invDisplayParams
inventoryDisplay :: SelectionSections () -> World -> Configuration -> Picture
inventoryDisplay sss w cfig = listPicturesAtScaleOff
(_ldpVerticalGap ldps)
(_ldpScale ldps)
(_ldpPosX ldps)
(_ldpPosY ldps)
cfig
0 -- offset
--undefined
pics
where
ldps = invDisplayParams w
-- pics' = take (_sssMaxSize sss) pics
-- totallength = length pics'
pics = foldMap (_ssShownItems) (_sssSections sss)
drawSubInventory :: SubInventory -> Configuration -> World -> Picture
drawSubInventory subinv cfig w = case subinv of
LockedInventory -> mempty -- topInvCursor col cursPos cfig w