Safe Haskell | None |
---|---|
Language | Haskell2010 |
Game.LambdaHack.Client.UI.Msg
Description
Game messages displayed on top of the screen for the player to read and then saved to player history.
- data Msg
- toMsg :: AttrLine -> Msg
- toPrompt :: AttrLine -> Msg
- data Report
- nullReport :: Report -> Bool
- consReport :: Msg -> Report -> Report
- renderReport :: Report -> AttrLine
- findInReport :: (AttrLine -> Bool) -> Report -> Maybe Msg
- data History
- newReport :: History -> Report
- emptyHistory :: Int -> History
- addToReport :: History -> Msg -> Int -> (History, Bool)
- archiveReport :: History -> Time -> History
- lengthHistory :: History -> Int
- renderHistory :: History -> [AttrLine]
- type UAttrLine = Vector Word32
- data RepMsgN
- uToAttrLine :: UAttrLine -> AttrLine
- attrLineToU :: AttrLine -> UAttrLine
- emptyReport :: Report
- snocReport :: Report -> Msg -> Int -> Report
- renderRepetition :: RepMsgN -> AttrLine
- scrapRepetition :: History -> Maybe History
- renderTimeReport :: Time -> Report -> [AttrLine]
Msg
The type of a single game message.
Report
The set of messages, with repetitions, to show at the screen at once.
nullReport :: Report -> Bool Source #
Test if the set of messages is empty.
History
The history of reports. This is a ring buffer of the given length containing old archived history and two most recent reports stored separately.
emptyHistory :: Int -> History Source #
Empty history of the given maximal length.
addToReport :: History -> Msg -> Int -> (History, Bool) Source #
Add a message to the new report of history, eliminating a possible duplicate and noting its existence in the result.
archiveReport :: History -> Time -> History Source #
Archive old report to history, filtering out prompts. Set up new report with a new timestamp.
lengthHistory :: History -> Int Source #
renderHistory :: History -> [AttrLine] Source #
Render history as many lines of text. New report is not rendered. It's expected to be empty when history is shown.
Internal operations
uToAttrLine :: UAttrLine -> AttrLine Source #
attrLineToU :: AttrLine -> UAttrLine Source #
emptyReport :: Report Source #
Empty set of messages.
renderRepetition :: RepMsgN -> AttrLine Source #