From 27a5b9b774b764fab8d63833ccef6512f442a885 Mon Sep 17 00:00:00 2001 From: justin Date: Mon, 6 Jun 2022 13:19:54 +0100 Subject: [PATCH] Continue work on terminals --- src/Dodge/Inventory.hs | 2 +- src/Dodge/Render/HUD.hs | 10 ++++++---- src/Dodge/Update.hs | 12 +++++++----- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Dodge/Inventory.hs b/src/Dodge/Inventory.hs index 1d58a9861..19be5b072 100644 --- a/src/Dodge/Inventory.hs +++ b/src/Dodge/Inventory.hs @@ -42,7 +42,7 @@ import LensHelp import qualified Data.Map.Strict as M --import qualified Data.Set as S import Data.Maybe -import qualified Data.Text as T +--import qualified Data.Text as T --import SDL --import Data.List --import System.Random diff --git a/src/Dodge/Render/HUD.hs b/src/Dodge/Render/HUD.hs index 7a63763e4..b18f61eaf 100644 --- a/src/Dodge/Render/HUD.hs +++ b/src/Dodge/Render/HUD.hs @@ -84,12 +84,12 @@ subInventoryDisplay subinv cfig w = case subinv of , invHead cfig "TWEAK" , listTextPicturesAt subInvX 60 cfig $ map text (ammoTweakStrings it) ] - DisplayTerminal {_termID = tid,_onInputLine=isoninput} -> + DisplayTerminal {_termID = tid,_onInputLine=inputstatus} -> let tp = w ^?! terminals . ix tid in pictures [ invHead cfig (_tmTitle tp ++ ":T" ++ show tid) , renderListAt subInvX 60 cfig - . displayTermInput tp + . displayTermInput inputstatus tp -- . (++ map (\(str,_) -> (str,white)) (_termOptions tp)) . reverse . take (_tmMaxLines tp) @@ -124,9 +124,11 @@ subInventoryDisplay subinv cfig w = case subinv of ] InspectInventory -> invHead cfig "INSPECT" where - displayTermInput tp = case _tmInput tp of + displayTermInput inputstatus tp = case _tmInput tp of Nothing -> id - Just s -> (++ [('>':T.unpack s++clockCycle 10 (V.fromList ["_",""]) w,white)]) + Just s -> (++ [('>':T.unpack s++displayBlinkCursor inputstatus,white)]) + displayBlinkCursor inputstatus | inputstatus = clockCycle 10 (V.fromList ["_",""]) w + | otherwise = [] closeobjectcursor = case selectedCloseObject w of Nothing -> mempty Just (i,co) -> listCursorNS clObjFloatIn 0 cfig (selNumPos i w) (closeObjectCol co) topInvW (invSelSize i w) diff --git a/src/Dodge/Update.hs b/src/Dodge/Update.hs index fa17e4964..d46e7cb4c 100644 --- a/src/Dodge/Update.hs +++ b/src/Dodge/Update.hs @@ -110,11 +110,13 @@ tmUpdate tm w = case w ^? terminals . ix (_tmID tm) . tmFutureLines . ix 0 of Just (TerminalLineEffect _ eff) -> w & pointTermParams . tmFutureLines %~ tail & eff tm - Just (TerminalLineInput _) -> w & pointTermParams %~ - ( ( tmFutureLines %~ tail ) --- . ( tmScrollCommands .~ scrollc ) --- . ( tmWriteCommands .~ writec ) - . ( tmInput ?~ T.empty ) ) + Just (TerminalLineInput _) -> w + & hud . hudElement . subInventory . onInputLine %~ const True + & pointTermParams %~ + ( ( tmFutureLines %~ tail ) +-- . ( tmScrollCommands .~ scrollc ) +-- . ( tmWriteCommands .~ writec ) + . ( tmInput ?~ T.empty ) ) where pointTermParams = terminals . ix (_tmID tm)