LambdaHack- A roguelike game engine in early and active development

Safe HaskellNone



Game messages displayed on top of the screen for the player to read.



makePhrase :: [Part] -> TextSource

Re-exported English phrase creation functions, applied to default irregular word sets.

makeSentence :: [Part] -> TextSource

Re-exported English phrase creation functions, applied to default irregular word sets.

type Msg = TextSource

The type of a single message.

(<>) :: Text -> Text -> Text

Identical to append.

(<+>) :: Text -> Text -> Text

Separated by space unless one of them is empty (in which case just the non-empty one).

showT :: Show a => a -> Text

Show a value in Text format.

moreMsg :: MsgSource

The "press something to see more" mark.

yesnoMsg :: MsgSource

The confirmation request message.

padMsg :: X -> Text -> TextSource

Add spaces at the message end, for display overlayed over the level map. Also trims (does not wrap!) too long lines.

data Report Source

The type of a set of messages to show at the screen at once.


emptyReport :: ReportSource

Empty set of messages.

nullReport :: Report -> BoolSource

Test if the set of messages is empty.

singletonReport :: Msg -> ReportSource

Construct a singleton set of messages.

addMsg :: Report -> Msg -> ReportSource

Add message to the end of report.

splitReport :: Report -> [Text]Source

Split a messages into chunks that fit in one line. We assume the width of the messages line is the same as of level map.

renderReport :: Report -> TextSource

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

data History Source

The history of reports.

emptyHistory :: HistorySource

Empty history of reports.

singletonHistory :: Report -> HistorySource

Construct a singleton history of reports.

addReport :: Report -> History -> HistorySource

Add a report to history, handling repetitions.

renderHistory :: History -> OverlaySource

Render history as many lines of text, wrapping if necessary.

takeHistory :: Int -> History -> HistorySource

Take the given prefix of reports from a history.

type Overlay = [Text]Source

A screenful of text lines. When displayed, they are trimmed, not wrapped and any lines below the lower screen edge are not visible.

splitOverlay :: Y -> Overlay -> [Overlay]Source

Split an overlay into overlays that fit on the screen.

stringByLocation :: X -> Y -> Overlay -> (Text, PointXY -> Maybe Char, Maybe Text)Source

Returns a function that looks up the characters in the string by location. Takes the width and height of the display plus the string. Returns also the message to print at the top and bottom.