Safe Haskell | None |
---|---|
Language | Haskell2010 |
Game messages displayed on top of the screen for the player to read and then saved to player history.
Synopsis
- data Msg
- toMsg :: Maybe (EnumMap MsgClass Color) -> MsgClass -> Text -> Msg
- data MsgClass
- = MsgAdmin
- | MsgBecome
- | MsgNoLonger
- | MsgLongerUs
- | MsgLonger
- | MsgItemCreation
- | MsgItemDestruction
- | MsgDeathGood
- | MsgDeathBad
- | MsgDeath
- | MsgDeathThreat
- | MsgLeader
- | MsgDiplomacy
- | MsgOutcome
- | MsgPlot
- | MsgLandscape
- | MsgTileDisco
- | MsgItemDisco
- | MsgActorSpot
- | MsgFirstEnemySpot
- | MsgItemSpot
- | MsgItemMove
- | MsgAction
- | MsgActionMinor
- | MsgEffectMajor
- | MsgEffect
- | MsgEffectMinor
- | MsgMisc
- | MsgHeardClose
- | MsgHeard
- | MsgFocus
- | MsgWarning
- | MsgRangedPowerfulWe
- | MsgRangedPowerfulUs
- | MsgRanged
- | MsgRangedUs
- | MsgRare
- | MsgVeryRare
- | MsgMeleePowerfulWe
- | MsgMeleePowerfulUs
- | MsgMeleeInterestingWe
- | MsgMeleeInterestingUs
- | MsgMelee
- | MsgMeleeUs
- | MsgDone
- | MsgAtFeetMajor
- | MsgAtFeet
- | MsgNumeric
- | MsgSpam
- | MsgMacro
- | MsgRunStop
- | MsgPrompt
- | MsgPromptFocus
- | MsgAlert
- | MsgStopPlayback
- interruptsRunning :: MsgClass -> Bool
- disturbsResting :: MsgClass -> Bool
- data Report
- nullReport :: Report -> Bool
- consReport :: Msg -> Report -> Report
- renderReport :: Report -> AttrLine
- anyInReport :: (MsgClass -> Bool) -> Report -> Bool
- data History
- newReport :: History -> Report
- emptyHistory :: Int -> History
- addToReport :: History -> Msg -> Int -> Time -> (History, Bool)
- archiveReport :: History -> History
- lengthHistory :: History -> Int
- renderHistory :: History -> [AttrLine]
- isSavedToHistory :: MsgClass -> Bool
- isDisplayed :: MsgClass -> Bool
- bindsPronouns :: MsgClass -> Bool
- msgColor :: MsgClass -> Color
- type UAttrLine = Vector Word32
- data RepMsgN
- uToAttrLine :: UAttrLine -> AttrLine
- attrLineToU :: AttrLine -> UAttrLine
- emptyReport :: Report
- snocReport :: Report -> Msg -> Int -> Report
- renderWholeReport :: Report -> AttrLine
- renderRepetition :: RepMsgN -> AttrLine
- scrapRepetition :: History -> Maybe History
- renderTimeReport :: Time -> Report -> [AttrLine]
Msg
The type of a single game message.
Instances
Eq Msg Source # | |
Show Msg Source # | |
Generic Msg Source # | |
Binary Msg Source # | |
type Rep Msg Source # | |
Defined in Game.LambdaHack.Client.UI.Msg type Rep Msg = D1 (MetaData "Msg" "Game.LambdaHack.Client.UI.Msg" "LambdaHack-0.9.3.1-inplace" False) (C1 (MetaCons "Msg" PrefixI True) (S1 (MetaSel (Just "msgLine") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 AttrLine) :*: S1 (MetaSel (Just "msgClass") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 MsgClass))) |
Instances
interruptsRunning :: MsgClass -> Bool Source #
disturbsResting :: MsgClass -> Bool Source #
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.
renderReport :: Report -> AttrLine Source #
Render a report as a (possibly very long) AttrLine
. Filter out
messages not meant for display.
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.
Instances
Show History Source # | |
Generic History Source # | |
Binary History Source # | |
type Rep History Source # | |
Defined in Game.LambdaHack.Client.UI.Msg type Rep History = D1 (MetaData "History" "Game.LambdaHack.Client.UI.Msg" "LambdaHack-0.9.3.1-inplace" False) (C1 (MetaCons "History" PrefixI True) ((S1 (MetaSel (Just "newReport") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Report) :*: S1 (MetaSel (Just "newTime") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Time)) :*: (S1 (MetaSel (Just "oldReport") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Report) :*: (S1 (MetaSel (Just "oldTime") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Time) :*: S1 (MetaSel (Just "archivedHistory") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 (RingBuffer UAttrLine)))))) |
emptyHistory :: Int -> History Source #
Empty history of the given maximal length.
addToReport :: History -> Msg -> Int -> Time -> (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 -> History Source #
Archive old report to history, filtering out messages with 0 duplicates and 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
isSavedToHistory :: MsgClass -> Bool Source #
isDisplayed :: MsgClass -> Bool Source #
bindsPronouns :: MsgClass -> Bool Source #
Instances
Show RepMsgN Source # | |
Generic RepMsgN Source # | |
Binary RepMsgN Source # | |
type Rep RepMsgN Source # | |
Defined in Game.LambdaHack.Client.UI.Msg type Rep RepMsgN = D1 (MetaData "RepMsgN" "Game.LambdaHack.Client.UI.Msg" "LambdaHack-0.9.3.1-inplace" False) (C1 (MetaCons "RepMsgN" PrefixI True) (S1 (MetaSel (Just "repMsg") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Msg) :*: S1 (MetaSel (Just "_repN") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Int))) |
uToAttrLine :: UAttrLine -> AttrLine Source #
attrLineToU :: AttrLine -> UAttrLine Source #
emptyReport :: Report Source #
Empty set of messages.
renderRepetition :: RepMsgN -> AttrLine Source #