Slightly rethink display of inventories and terminals

This commit is contained in:
2025-09-18 19:56:12 +01:00
parent e017a92892
commit 2d856ddf9e
13 changed files with 154 additions and 137 deletions
+18 -17
View File
@@ -52,12 +52,14 @@ drawHUD :: Config -> World -> Picture
drawHUD cfig w = case w ^. hud of
-- DisplayCarte -> drawCarte cfig w
HUD {_diSections = sections, _subInventory = subinv} ->
drawInventory sections w cfig
drawInventory sections w cfig subinv
<> drawSubInventory subinv cfig w
drawInventory :: IM.IntMap (SelectionSection ()) -> World -> Config -> Picture
drawInventory sss w cfig =
drawSelectionSections sss invDP cfig
drawInventory
:: IM.IntMap (SelectionSection ()) -> World -> Config -> SubInventory -> Picture
drawInventory sss w cfig = \case
DisplayTerminal {} -> mempty
_ -> drawSelectionSections sss invDP cfig
<> drawSSCursor sss invDP curs cfig (f $ w ^? hud . diSelection . _Just)
<> drawRootCursor w sss (f $ w ^? hud . diSelection . _Just) invDP cfig
<> itemconnections
@@ -184,8 +186,8 @@ drawCombineInventory ::
World ->
Picture
drawCombineInventory cfig sss w =
invHead cfig "COMBINE"
<> drawSelectionSections sss secondColumnLDP cfig
-- invHead cfig "COMBINE"
drawSelectionSections sss secondColumnLDP cfig
<> drawSSCursor sss secondColumnLDP curs cfig msel
<> combineInventoryExtra sss msel cfig w
where
@@ -363,22 +365,21 @@ combineInventoryExtra sss msel cfig w = fold $ do
drawTerminalDisplay :: LWorld -> Config -> Terminal -> Picture
drawTerminalDisplay lw cfig tm =
invHead cfig ("T-" ++ show tid)
<> drawSelectionList secondColumnLDP cfig f
<> color
(withAlpha 0.5 green) -- consider integrating termScreenColor somehow
(drawSelectionListBackground secondColumnLDP cfig tsize)
<> color (dark $ _tmExternalColor tm) (drawTitleBackground cfig)
drawSelectionList invDP cfig f
-- <> invHead cfig ("TERMINAL-" ++ show tid)
-- <> color
-- (withAlpha 0.5 green) -- consider integrating termScreenColor somehow
-- (drawSelectionListBackground secondColumnLDP cfig tsize)
-- <> color (dark $ _tmExternalColor tm) (drawTitleBackground cfig)
where
tid = tm ^. tmID
tsize = getMaxLinesTM + 1
-- tsize = getMaxLinesTM + 1
toselitm (str, col) = SelItem [str] 1 55 True col 0 Nothing
-- not sure if the width (55) is correct here
f =
map toselitm . displayTermInput
f = toselitm ("TERMINAL " ++ show tid,white) :
(map (toselitm . (_1 %~ (" "<>))) . displayTermInput
. reverse
-- . take getMaxLinesTM
$ _tmDisplayedLines tm
$ _tmDisplayedLines tm)
displayTermInput = case _tmStatus tm of
TerminalOff -> id
TerminalDeactivated -> id