Start work simplifying terminals, aim towards respawn terminals
This commit is contained in:
@@ -47,7 +47,7 @@ data Terminal = Terminal
|
||||
, _tmCommandHistory :: [String]
|
||||
, _tmToggles :: M.Map String TerminalToggle
|
||||
, _tmPartialCommand :: Maybe TerminalCommand
|
||||
, _tmType :: TerminalType
|
||||
-- , _tmType :: TerminalType
|
||||
}
|
||||
--deriving (Eq, Show, Read) --, Generic)
|
||||
--h--deriving (Eq, Show, Read) --Generic, Flat)
|
||||
|
||||
@@ -25,7 +25,6 @@ defaultTerminal =
|
||||
, _tmCommandHistory = []
|
||||
, _tmToggles = mempty
|
||||
, _tmPartialCommand = Nothing
|
||||
, _tmType = DefaultTerminal
|
||||
, _tmExternalColor = dark magenta
|
||||
}
|
||||
|
||||
|
||||
@@ -363,7 +363,7 @@ combineInventoryExtra sss msel cfig w = fromMaybe mempty $ do
|
||||
drawTerminalDisplay :: Int -> Configuration -> LWorld -> Picture
|
||||
drawTerminalDisplay tid cfig w = fromMaybe mempty $ do
|
||||
tm <- w ^? terminals . ix tid
|
||||
let tsize = getMaxLinesTM (tm ^. tmType) + 1
|
||||
let tsize = getMaxLinesTM + 1
|
||||
return $
|
||||
invHead cfig (_tmTitle tm ++ ":T" ++ show tid)
|
||||
<> drawSelectionList secondColumnParams cfig (thesellist tm)
|
||||
@@ -378,14 +378,14 @@ drawTerminalDisplay tid cfig w = fromMaybe mempty $ do
|
||||
thelist tm =
|
||||
map toselitm . displayTermInput tm
|
||||
. reverse
|
||||
. take (getMaxLinesTM (tm ^. tmType))
|
||||
. take getMaxLinesTM
|
||||
$ _tmDisplayedLines tm
|
||||
displayTermInput tm = case _tmInput tm of
|
||||
TerminalInput{_tiText = s} ->
|
||||
(++ [(displayInputText tm s ++ [cFilledRect], white)])
|
||||
partcommand tm = maybe "" (++ " ") $ tm ^? tmPartialCommand . _Just . tcString
|
||||
displayInputText tm s
|
||||
| _tmStatus tm == TerminalReady = partcommand tm ++ getPromptTM (tm ^. tmType) ++ s
|
||||
| _tmStatus tm == TerminalReady = partcommand tm ++ getPromptTM ++ s
|
||||
| otherwise = ""
|
||||
|
||||
-- | hasfoc = clockCycle 10 (V.fromList [[cFilledRect] , "."]) w
|
||||
|
||||
@@ -284,7 +284,7 @@ terminalReturnEffect tmid w = fromMaybe w $ do
|
||||
w
|
||||
& cWorld . lWorld . terminals . ix tmid . tmPartialCommand .~ Nothing
|
||||
& cWorld . lWorld . terminals . ix tmid . tmFutureLines
|
||||
.~ [makeTermLine (pc ++ getPromptTM (tm ^. tmType) ++ s)]
|
||||
.~ [makeTermLine (pc ++ getPromptTM ++ s)]
|
||||
|
||||
runTerminalString :: String -> Terminal -> World -> World
|
||||
runTerminalString s tm w =
|
||||
|
||||
@@ -3,10 +3,8 @@ module Dodge.Terminal.Type (
|
||||
getMaxLinesTM,
|
||||
) where
|
||||
|
||||
import Dodge.Data.Terminal
|
||||
getPromptTM :: String
|
||||
getPromptTM = "> "
|
||||
|
||||
getPromptTM :: TerminalType -> String
|
||||
getPromptTM _ = "> "
|
||||
|
||||
getMaxLinesTM :: TerminalType -> Int
|
||||
getMaxLinesTM _ = 14
|
||||
getMaxLinesTM :: Int
|
||||
getMaxLinesTM = 14
|
||||
|
||||
+4
-4
@@ -397,7 +397,7 @@ updateMouseContextGame cfig u = case u ^. uvWorld . input . mouseContext of
|
||||
tmid <- w ^? hud . hudElement . subInventory . termID
|
||||
tm <- w ^? cWorld . lWorld . terminals . ix tmid
|
||||
return $
|
||||
if isOverTerminalScreen cfig tm mpos
|
||||
if isOverTerminalScreen cfig mpos
|
||||
then fromMaybe NoMouseContext $ do
|
||||
let s = tm ^. tmInput . tiText
|
||||
guard $ not (null s) && _tmStatus tm == TerminalReady
|
||||
@@ -415,8 +415,8 @@ getMenuMouseContext screen u = case screen ^. scOptions of
|
||||
Just True -> MouseMenuClick yi
|
||||
_ -> NoMouseContext
|
||||
|
||||
isOverTerminalScreen :: Configuration -> Terminal -> Point2 -> Bool
|
||||
isOverTerminalScreen cfig tm (V2 x y) =
|
||||
isOverTerminalScreen :: Configuration -> Point2 -> Bool
|
||||
isOverTerminalScreen cfig (V2 x y) =
|
||||
x <= xmax
|
||||
&& x >= xmin - 5
|
||||
&& y <= ymax + 5
|
||||
@@ -424,7 +424,7 @@ isOverTerminalScreen cfig tm (V2 x y) =
|
||||
where
|
||||
ldp = secondColumnParams
|
||||
V2 xmin ymax = screenPosAbs cfig (ldp ^. ldpPos)
|
||||
tsize = fromIntegral $ getMaxLinesTM (tm ^. tmType) + 1
|
||||
tsize = fromIntegral $ getMaxLinesTM + 1
|
||||
s = 5 + tsize * (20 * ldp ^. ldpScale + ldp ^. ldpVerticalGap)
|
||||
ymin = ymax - s
|
||||
xmax = xmin + 555 -- HACK drawSelectionListBackground
|
||||
|
||||
Reference in New Issue
Block a user