LambdaHack-0.9.5.0: A game engine library for tactical squad ASCII roguelike dungeon crawlers
Safe HaskellNone
LanguageHaskell2010

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.

Synopsis

Msg

data Msg Source #

The type of a single game message.

Instances

Instances details
Eq Msg Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Methods

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

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

Show Msg Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Methods

showsPrec :: Int -> Msg -> ShowS #

show :: Msg -> String #

showList :: [Msg] -> ShowS #

Generic Msg Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Associated Types

type Rep Msg :: Type -> Type

Methods

from :: Msg -> Rep Msg x

to :: Rep Msg x -> Msg

Binary Msg Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Methods

put :: Msg -> Put

get :: Get Msg

putList :: [Msg] -> Put

type Rep Msg Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

type Rep Msg = D1 ('MetaData "Msg" "Game.LambdaHack.Client.UI.Msg" "LambdaHack-0.9.5.0-4ovYxwv1jih9UUX4cyhTOG" 'False) (C1 ('MetaCons "Msg" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgLine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 AttrLine) :*: S1 ('MetaSel ('Just "msgClass") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 MsgClass)))

data MsgClass Source #

Instances

Instances details
Enum MsgClass Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Eq MsgClass Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Read MsgClass Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Show MsgClass Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Generic MsgClass Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Associated Types

type Rep MsgClass :: Type -> Type

Methods

from :: MsgClass -> Rep MsgClass x

to :: Rep MsgClass x -> MsgClass

NFData MsgClass Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Methods

rnf :: MsgClass -> ()

Binary MsgClass Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Methods

put :: MsgClass -> Put

get :: Get MsgClass

putList :: [MsgClass] -> Put

type Rep MsgClass Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

type Rep MsgClass = D1 ('MetaData "MsgClass" "Game.LambdaHack.Client.UI.Msg" "LambdaHack-0.9.5.0-4ovYxwv1jih9UUX4cyhTOG" 'False) (((((C1 ('MetaCons "MsgAdmin" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "MsgBecome" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgNoLonger" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "MsgLongerUs" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "MsgLonger" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgItemCreation" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "MsgItemDestruction" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "MsgDeathGood" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgDeathBad" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "MsgDeath" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgDeathThreat" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MsgLeader" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgDiplomacy" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "MsgOutcome" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "MsgPlot" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgLandscape" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "MsgTileDisco" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgItemDisco" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MsgActorSpot" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgFirstEnemySpot" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "MsgItemSpot" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "MsgItemMove" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgAction" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "MsgActionMinor" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgEffectMajor" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MsgEffect" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgEffectMinor" 'PrefixI 'False) (U1 :: Type -> Type)))))) :+: ((((C1 ('MetaCons "MsgMisc" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "MsgHeardClose" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgHeard" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "MsgFocus" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgWarning" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MsgRangedPowerfulWe" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgRangedPowerfulUs" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "MsgRanged" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "MsgRangedUs" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgRare" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "MsgVeryRare" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgMeleePowerfulWe" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MsgMeleePowerfulUs" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgMeleeInterestingWe" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "MsgMeleeInterestingUs" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "MsgMelee" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgMeleeUs" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "MsgDone" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgAtFeetMajor" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MsgAtFeet" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgNumeric" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "MsgSpam" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "MsgMacro" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgRunStop" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "MsgPrompt" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgPromptFocus" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MsgAlert" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgStopPlayback" 'PrefixI 'False) (U1 :: Type -> Type)))))))

Report

data Report Source #

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

Instances

Instances details
Show Report Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Binary Report Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Methods

put :: Report -> Put

get :: Get Report

putList :: [Report] -> Put

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. Filter out messages not meant for display.

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.

Instances

Instances details
Show History Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Generic History Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Associated Types

type Rep History :: Type -> Type

Methods

from :: History -> Rep History x

to :: Rep History x -> History

Binary History Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Methods

put :: History -> Put

get :: Get History

putList :: [History] -> Put

type Rep History Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

type Rep History = D1 ('MetaData "History" "Game.LambdaHack.Client.UI.Msg" "LambdaHack-0.9.5.0-4ovYxwv1jih9UUX4cyhTOG" '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.

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

type UAttrLine = Vector Word32 Source #

data RepMsgN Source #

Instances

Instances details
Show RepMsgN Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Generic RepMsgN Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Associated Types

type Rep RepMsgN :: Type -> Type

Methods

from :: RepMsgN -> Rep RepMsgN x

to :: Rep RepMsgN x -> RepMsgN

Binary RepMsgN Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Methods

put :: RepMsgN -> Put

get :: Get RepMsgN

putList :: [RepMsgN] -> Put

type Rep RepMsgN Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

type Rep RepMsgN = D1 ('MetaData "RepMsgN" "Game.LambdaHack.Client.UI.Msg" "LambdaHack-0.9.5.0-4ovYxwv1jih9UUX4cyhTOG" 'False) (C1 ('MetaCons "RepMsgN" 'PrefixI 'True) (S1 ('MetaSel ('Just "repMsg") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Msg) :*: S1 ('MetaSel ('Just "_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.

renderWholeReport :: Report -> AttrLine Source #

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