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
+1 -3
View File
@@ -1,6 +1,4 @@
module Dodge.Clock (
clockCycle,
) where
module Dodge.Clock (clockCycle) where
import Control.Lens
import qualified Data.Vector as V
-1
View File
@@ -13,7 +13,6 @@ data TerminalStatus
| TerminalLineRead
| TerminalTextInput {_tiText :: String}
| TerminalPressTo {_tptString :: String}
| TerminalWaiting
deriving (Eq,Show)
makeLenses ''TerminalStatus
+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
+1
View File
@@ -13,6 +13,7 @@ module Dodge.Terminal (
tabComplete,
tlSetStatus,
tlDoEffect,
termTextColor,
) where
import Color
-1
View File
@@ -12,4 +12,3 @@ termScreenColor tm = case tm ^. tmStatus of
TerminalTextInput _ -> Just green
TerminalPressTo{} -> Just green
TerminalLineRead -> Just white
TerminalWaiting -> Just green
-1
View File
@@ -62,7 +62,6 @@ accessTerminal tid w = fromMaybe w $ do
TerminalTextInput{} -> tm
TerminalLineRead -> tm
TerminalPressTo{} -> tm
TerminalWaiting{} -> tm
TerminalOff ->
tm
& tmFutureLines .~ _tmBootLines tm