Add spinning cursor to terminal line read

This commit is contained in:
2025-09-02 10:24:43 +01:00
parent 7fcaac2a01
commit 2261556c16
6 changed files with 10 additions and 13 deletions
+8 -7
View File
@@ -2,6 +2,9 @@
module Dodge.Render.HUD (drawHUD) where
import Dodge.Clock
import qualified Data.Vector as V
import Dodge.Terminal
import Dodge.Inventory.CheckSlots
import Control.Applicative
import Control.Lens
@@ -161,7 +164,7 @@ drawSubInventory subinv cfig w = case subinv of
-- LockedInventory -> mempty -- topInvCursor col cursPos cfig w
NoSubInventory{} -> drawRBOptions cfig w
ExamineInventory -> drawExamineInventory cfig w
DisplayTerminal tid -> foldMap (drawTerminalDisplay cfig)
DisplayTerminal tid -> foldMap (drawTerminalDisplay (w ^.cWorld.lWorld) cfig)
(w ^? cWorld . lWorld . terminals . ix tid)
CombineInventory{_ciSections = sss} -> drawCombineInventory cfig sss w
MapperInventory _ _ itid -> drawMapperInventory itid w
@@ -358,8 +361,8 @@ combineInventoryExtra sss msel cfig w = fold $ do
sss'
(Just (0, i))
drawTerminalDisplay :: Config -> Terminal -> Picture
drawTerminalDisplay cfig tm =
drawTerminalDisplay :: LWorld -> Config -> Terminal -> Picture
drawTerminalDisplay lw cfig tm =
invHead cfig ("T-" ++ show tid)
<> drawSelectionList secondColumnLDP cfig f
<> color
@@ -379,14 +382,12 @@ drawTerminalDisplay cfig tm =
displayTermInput = case _tmStatus tm of
TerminalOff -> id
TerminalDeactivated -> id
TerminalLineRead -> id
TerminalWaiting -> (++ [("...",white)])
TerminalLineRead -> (++ [(spincurs,termTextColor)])
TerminalTextInput s ->
(++ [(getPromptTM ++ s ++ [cFilledRect], white)])
TerminalPressTo s ->
(++ [("<" ++ s ++ ">", white)])
-- | hasfoc = clockCycle 10 (V.fromList [[cFilledRect] , "."]) w
spincurs = clockCycle 4 (V.fromList ["/","-","\\","|"]) lw
lnkMidPosInvSelsCol :: Config -> World -> Int -> Color -> [Int] -> Picture
lnkMidPosInvSelsCol cfig w i col = fromMaybe mempty . foldMap f