LambdaHack-0.8.3.0: A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Client.UI.Msg

Contents

Description

Game messages displayed on top of the screen for the player to read and then saved to player history.

Synopsis

Msg

data Msg Source #

The type of a single game message.

Instances

Eq Msg Source # 

Methods

(==) :: Msg -> Msg -> Bool #

(/=) :: Msg -> Msg -> Bool #

Show Msg Source # 

Methods

showsPrec :: Int -> Msg -> ShowS #

show :: Msg -> String #

showList :: [Msg] -> ShowS #

Generic Msg Source # 

Associated Types

type Rep Msg :: * -> * #

Methods

from :: Msg -> Rep Msg x #

to :: Rep Msg x -> Msg #

Binary Msg Source # 

Methods

put :: Msg -> Put #

get :: Get Msg #

putList :: [Msg] -> Put #

type Rep Msg Source # 
type Rep Msg = D1 * (MetaData "Msg" "Game.LambdaHack.Client.UI.Msg" "LambdaHack-0.8.3.0-7BJnKAztOSt10pFm84xYR4" False) (C1 * (MetaCons "Msg" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "msgLine") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * AttrLine)) (S1 * (MetaSel (Just Symbol "msgHist") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Bool))))

Report

data Report Source #

The set of messages, with repetitions, to show at the screen at once.

Instances

nullReport :: Report -> Bool Source #

Test if the set of messages is empty.

consReport :: Msg -> Report -> Report Source #

Add a message to the start of report.

renderReport :: Report -> AttrLine Source #

Render a report as a (possibly very long) AttrLine.

History

data History Source #

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.

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

data RepMsgN Source #

Instances

Show RepMsgN Source # 
Generic RepMsgN Source # 

Associated Types

type Rep RepMsgN :: * -> * #

Methods

from :: RepMsgN -> Rep RepMsgN x #

to :: Rep RepMsgN x -> RepMsgN #

Binary RepMsgN Source # 

Methods

put :: RepMsgN -> Put #

get :: Get RepMsgN #

putList :: [RepMsgN] -> Put #

type Rep RepMsgN Source # 
type Rep RepMsgN = D1 * (MetaData "RepMsgN" "Game.LambdaHack.Client.UI.Msg" "LambdaHack-0.8.3.0-7BJnKAztOSt10pFm84xYR4" False) (C1 * (MetaCons "RepMsgN" PrefixI True) ((:*:) * (S1 * (MetaSel (Just Symbol "repMsg") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Msg)) (S1 * (MetaSel (Just Symbol "_repN") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Int))))

emptyReport :: Report Source #

Empty set of messages.

snocReport :: Report -> Msg -> Int -> Report Source #

Add a message to the end of the report.