Add connector between terminal button and temrinal display

This commit is contained in:
2025-12-23 22:54:56 +00:00
parent 34c86c6a1b
commit 6becda01d5
2 changed files with 13 additions and 4 deletions
+5
View File
@@ -5,6 +5,7 @@ module Dodge.Render.Connectors (
zConnectCol,
zConnectColMidX,
lConnect,
lConnectCol,
lConnectMulti,
) where
@@ -42,6 +43,10 @@ zConnectColMidX (V2 x y) (V2 a b) midx c1 c2 c3 c4 =
lConnect :: Point2 -> Point2 -> Picture
lConnect sp@(V2 _ y) ep@(V2 x _) = line [sp, V2 x y, ep]
lConnectCol :: Point2 -> Point2 -> Color -> Color -> Color -> Picture
lConnectCol sp@(V2 _ y) ep@(V2 x _) c1 c2 c3 = lineCol
$ zip [sp, V2 x y, ep] [c1,c2,c3]
-- this function is the reason for the incomplete-uni-patterns warning suppression
lConnectMulti :: [Point2] -> Point2 -> Picture
lConnectMulti sps (V2 x y) =
+8 -4
View File
@@ -389,17 +389,21 @@ drawTerminalDisplay w cfig tid = fold $ do
drawTerminalCursorLink :: World -> Config -> Terminal -> Picture
drawTerminalCursorLink w cfig tm = fold $ do
j <- elemIndex (tm ^. tmButtonID) $ w ^. hud . closeButtons
return . translateScreenPos cfig (invDP ^. ldpPos)
$ selSecDrawCursor invDP
lp <- selNumPos cfig invDP (w^. hud . diSections) 5 j
let rp = screenPosAbs cfig (secondColumnLDP ^. ldpPos) - V2 5 10
lcol <- selSecSelCol 5 j (w ^. hud . diSections)
return $ translateScreenPos cfig (invDP ^. ldpPos)
(selSecDrawCursor invDP
(BoundaryCursor [North,South,East,West])
(w ^. hud . diSections)
(Just (5,j))
(Just (5,j)))
<> lConnectCol (lp + V2 155 0) rp lcol white white
lnkMidPosInvSelsCol :: Config -> World -> Int -> Color -> [Int] -> Picture
lnkMidPosInvSelsCol cfig w i col = fromMaybe mempty . foldMap f
where
f j = do
sss <- w ^? hud . diSections
let sss = w ^. hud . diSections
combinesss <- w ^? hud . subInventory . ciSections
lp <- selNumPos cfig invDP sss 0 j
rp <- selNumPos cfig secondColumnLDP combinesss 0 i