Continue work on terminals

This commit is contained in:
2022-06-06 13:19:54 +01:00
parent eb38874102
commit 27a5b9b774
3 changed files with 14 additions and 10 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ import LensHelp
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
--import qualified Data.Set as S --import qualified Data.Set as S
import Data.Maybe import Data.Maybe
import qualified Data.Text as T --import qualified Data.Text as T
--import SDL --import SDL
--import Data.List --import Data.List
--import System.Random --import System.Random
+6 -4
View File
@@ -84,12 +84,12 @@ subInventoryDisplay subinv cfig w = case subinv of
, invHead cfig "TWEAK" , invHead cfig "TWEAK"
, listTextPicturesAt subInvX 60 cfig $ map text (ammoTweakStrings it) , listTextPicturesAt subInvX 60 cfig $ map text (ammoTweakStrings it)
] ]
DisplayTerminal {_termID = tid,_onInputLine=isoninput} -> DisplayTerminal {_termID = tid,_onInputLine=inputstatus} ->
let tp = w ^?! terminals . ix tid let tp = w ^?! terminals . ix tid
in pictures in pictures
[ invHead cfig (_tmTitle tp ++ ":T" ++ show tid) [ invHead cfig (_tmTitle tp ++ ":T" ++ show tid)
, renderListAt subInvX 60 cfig , renderListAt subInvX 60 cfig
. displayTermInput tp . displayTermInput inputstatus tp
-- . (++ map (\(str,_) -> (str,white)) (_termOptions tp)) -- . (++ map (\(str,_) -> (str,white)) (_termOptions tp))
. reverse . reverse
. take (_tmMaxLines tp) . take (_tmMaxLines tp)
@@ -124,9 +124,11 @@ subInventoryDisplay subinv cfig w = case subinv of
] ]
InspectInventory -> invHead cfig "INSPECT" InspectInventory -> invHead cfig "INSPECT"
where where
displayTermInput tp = case _tmInput tp of displayTermInput inputstatus tp = case _tmInput tp of
Nothing -> id 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 closeobjectcursor = case selectedCloseObject w of
Nothing -> mempty Nothing -> mempty
Just (i,co) -> listCursorNS clObjFloatIn 0 cfig (selNumPos i w) (closeObjectCol co) topInvW (invSelSize i w) Just (i,co) -> listCursorNS clObjFloatIn 0 cfig (selNumPos i w) (closeObjectCol co) topInvW (invSelSize i w)
+7 -5
View File
@@ -110,11 +110,13 @@ tmUpdate tm w = case w ^? terminals . ix (_tmID tm) . tmFutureLines . ix 0 of
Just (TerminalLineEffect _ eff) -> w Just (TerminalLineEffect _ eff) -> w
& pointTermParams . tmFutureLines %~ tail & pointTermParams . tmFutureLines %~ tail
& eff tm & eff tm
Just (TerminalLineInput _) -> w & pointTermParams %~ Just (TerminalLineInput _) -> w
( ( tmFutureLines %~ tail ) & hud . hudElement . subInventory . onInputLine %~ const True
-- . ( tmScrollCommands .~ scrollc ) & pointTermParams %~
-- . ( tmWriteCommands .~ writec ) ( ( tmFutureLines %~ tail )
. ( tmInput ?~ T.empty ) ) -- . ( tmScrollCommands .~ scrollc )
-- . ( tmWriteCommands .~ writec )
. ( tmInput ?~ T.empty ) )
where where
pointTermParams = terminals . ix (_tmID tm) pointTermParams = terminals . ix (_tmID tm)