Work on terminals

This commit is contained in:
2023-05-03 11:19:47 +01:00
parent 61f88aeb4a
commit ed8d8f0e93
8 changed files with 79 additions and 107 deletions
+5 -8
View File
@@ -3,8 +3,8 @@ module Dodge.Render.HUD (
drawHUD,
) where
import Data.Foldable
import Control.Lens
import Data.Foldable
import qualified Data.Map.Strict as M
import Data.Maybe
import qualified Data.Vector as V
@@ -203,14 +203,11 @@ displayTerminal :: Int -> Configuration -> LWorld -> Picture
displayTerminal tid cfig w = fromMaybe mempty $ do
tm <- w ^? terminals . ix tid
return $
pictures
[ invHead cfig (_tmTitle tm ++ ":T" ++ show tid)
, drawSelectionList secondColumnParams cfig (thesellist tm)
]
invHead cfig (_tmTitle tm ++ ":T" ++ show tid)
<> drawSelectionList secondColumnParams cfig (thesellist tm)
where
toselitm (str, col) = SelectionItem [str] 1 True col 0 ()
thesellist tm =
defaultSelectionList & slItems .~ thelist tm
thesellist tm = defaultSelectionList & slItems .~ thelist tm
thelist tm =
map toselitm . displayTermInput tm
. reverse
@@ -218,7 +215,7 @@ displayTerminal tid cfig w = fromMaybe mempty $ do
$ _tmDisplayedLines tm
displayTermInput tm = case _tmInput tm of
TerminalInput s hasfoc _ -> (++ [(displayInputText tm s ++ displayBlinkCursor hasfoc, white)])
partcommand tm = fromMaybe "" $ tm ^? tmPartialCommand . _Just
partcommand tm = maybe "" (++ " ") $ tm ^? tmPartialCommand . _Just
displayInputText tm s
| _tmStatus tm == TerminalReady = partcommand tm ++ "> " ++ s
| otherwise = ""