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 ( module Dodge.Clock (clockCycle) where
clockCycle,
) where
import Control.Lens import Control.Lens
import qualified Data.Vector as V import qualified Data.Vector as V
-1
View File
@@ -13,7 +13,6 @@ data TerminalStatus
| TerminalLineRead | TerminalLineRead
| TerminalTextInput {_tiText :: String} | TerminalTextInput {_tiText :: String}
| TerminalPressTo {_tptString :: String} | TerminalPressTo {_tptString :: String}
| TerminalWaiting
deriving (Eq,Show) deriving (Eq,Show)
makeLenses ''TerminalStatus makeLenses ''TerminalStatus
+8 -7
View File
@@ -2,6 +2,9 @@
module Dodge.Render.HUD (drawHUD) where module Dodge.Render.HUD (drawHUD) where
import Dodge.Clock
import qualified Data.Vector as V
import Dodge.Terminal
import Dodge.Inventory.CheckSlots import Dodge.Inventory.CheckSlots
import Control.Applicative import Control.Applicative
import Control.Lens import Control.Lens
@@ -161,7 +164,7 @@ drawSubInventory subinv cfig w = case subinv of
-- LockedInventory -> mempty -- topInvCursor col cursPos cfig w -- LockedInventory -> mempty -- topInvCursor col cursPos cfig w
NoSubInventory{} -> drawRBOptions cfig w NoSubInventory{} -> drawRBOptions cfig w
ExamineInventory -> drawExamineInventory 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) (w ^? cWorld . lWorld . terminals . ix tid)
CombineInventory{_ciSections = sss} -> drawCombineInventory cfig sss w CombineInventory{_ciSections = sss} -> drawCombineInventory cfig sss w
MapperInventory _ _ itid -> drawMapperInventory itid w MapperInventory _ _ itid -> drawMapperInventory itid w
@@ -358,8 +361,8 @@ combineInventoryExtra sss msel cfig w = fold $ do
sss' sss'
(Just (0, i)) (Just (0, i))
drawTerminalDisplay :: Config -> Terminal -> Picture drawTerminalDisplay :: LWorld -> Config -> Terminal -> Picture
drawTerminalDisplay cfig tm = drawTerminalDisplay lw cfig tm =
invHead cfig ("T-" ++ show tid) invHead cfig ("T-" ++ show tid)
<> drawSelectionList secondColumnLDP cfig f <> drawSelectionList secondColumnLDP cfig f
<> color <> color
@@ -379,14 +382,12 @@ drawTerminalDisplay cfig tm =
displayTermInput = case _tmStatus tm of displayTermInput = case _tmStatus tm of
TerminalOff -> id TerminalOff -> id
TerminalDeactivated -> id TerminalDeactivated -> id
TerminalLineRead -> id TerminalLineRead -> (++ [(spincurs,termTextColor)])
TerminalWaiting -> (++ [("...",white)])
TerminalTextInput s -> TerminalTextInput s ->
(++ [(getPromptTM ++ s ++ [cFilledRect], white)]) (++ [(getPromptTM ++ s ++ [cFilledRect], white)])
TerminalPressTo s -> TerminalPressTo s ->
(++ [("<" ++ s ++ ">", white)]) (++ [("<" ++ s ++ ">", white)])
spincurs = clockCycle 4 (V.fromList ["/","-","\\","|"]) lw
-- | hasfoc = clockCycle 10 (V.fromList [[cFilledRect] , "."]) w
lnkMidPosInvSelsCol :: Config -> World -> Int -> Color -> [Int] -> Picture lnkMidPosInvSelsCol :: Config -> World -> Int -> Color -> [Int] -> Picture
lnkMidPosInvSelsCol cfig w i col = fromMaybe mempty . foldMap f lnkMidPosInvSelsCol cfig w i col = fromMaybe mempty . foldMap f
+1
View File
@@ -13,6 +13,7 @@ module Dodge.Terminal (
tabComplete, tabComplete,
tlSetStatus, tlSetStatus,
tlDoEffect, tlDoEffect,
termTextColor,
) where ) where
import Color import Color
-1
View File
@@ -12,4 +12,3 @@ termScreenColor tm = case tm ^. tmStatus of
TerminalTextInput _ -> Just green TerminalTextInput _ -> Just green
TerminalPressTo{} -> Just green TerminalPressTo{} -> Just green
TerminalLineRead -> Just white TerminalLineRead -> Just white
TerminalWaiting -> Just green
-1
View File
@@ -62,7 +62,6 @@ accessTerminal tid w = fromMaybe w $ do
TerminalTextInput{} -> tm TerminalTextInput{} -> tm
TerminalLineRead -> tm TerminalLineRead -> tm
TerminalPressTo{} -> tm TerminalPressTo{} -> tm
TerminalWaiting{} -> tm
TerminalOff -> TerminalOff ->
tm tm
& tmFutureLines .~ _tmBootLines tm & tmFutureLines .~ _tmBootLines tm