Work on terminals: allow scrolling to get default inputs

This commit is contained in:
2022-06-01 22:22:46 +01:00
parent 0585236a01
commit 0da298bde9
10 changed files with 140 additions and 95 deletions
+20 -8
View File
@@ -137,6 +137,7 @@ data World = World
, _timeFlow :: TimeFlowStatus
, _worldClock :: Int
, _doubleMouseHammer :: HammerPosition
, _backspaceTimer :: Int
}
data HUDElement
@@ -386,22 +387,23 @@ data TerminalParams = NoTerminalParams | TerminalParams
, _termFutureLines :: [TerminalLine]
, _termMaxLines :: Int
, _termTitle :: String
, _termSel :: Maybe Int
, _termOptions :: [(String, World -> World)]
, _termInput :: Maybe (T.Text, String -> World -> World)
, _termSel :: Maybe (Int,Int)
-- , _termOptions :: [(String, World -> World)]
, _termInput :: Maybe T.Text
, _termCommands :: [TerminalCommand]
}
data TerminalLine
= TerminalLineDisplay
{_tlPause :: Int
,_tlString :: World -> (String, Color)
}
| TerminalLineChoice
{_tlPause :: Int
,_tlOptions :: [(String,World -> World)]
}
-- | TerminalLineChoice
-- {_tlPause :: Int
-- ,_tlOptions :: [(String,World -> World)]
-- }
| TerminalLineInput
{_tlPause :: Int
,_tlInputFunction :: String -> World -> World
,_tlCommands :: [TerminalCommand]
}
| TerminalLineEffect
{_tlPause :: Int
@@ -1316,6 +1318,15 @@ data CreatureState = CrSt
, _crDropsOnDeath :: CreatureDropType
}
data TerminalCommand = TerminalCommand
{ _tcString :: String
, _tcAlias :: [String]
, _tcHelp :: String
, _tcArgumentType :: Maybe String
, _tcArguments :: World -> [String]
, _tcEffect :: [String] -> World -> Either String World
}
makeLenses ''CreatureState
makeLenses ''Damage
makeLenses ''DamageEffect
@@ -1381,3 +1392,4 @@ makeLenses ''RightButtonOptions
makeLenses ''AllocateEquipment
makeLenses ''ActivateEquipment
makeLenses ''EquipParams
makeLenses ''TerminalCommand