Safe Haskell | None |
---|---|
Language | Haskell2010 |
Game messages displayed on top of the screen for the player to read.
- makePhrase :: [MU.Part] -> T.Text
- makeSentence :: [MU.Part] -> T.Text
- type Msg = T.Text
- (<>) :: Monoid m => m -> m -> m
- (<+>) :: T.Text -> T.Text -> T.Text
- tshow :: Show a => a -> T.Text
- toWidth :: Int -> T.Text -> T.Text
- moreMsg :: Msg
- yesnoMsg :: Msg
- truncateMsg :: X -> T.Text -> T.Text
- data Report
- emptyReport :: Report
- nullReport :: Report -> Bool
- singletonReport :: Msg -> Report
- addMsg :: Report -> Msg -> Report
- prependMsg :: Msg -> Report -> Report
- splitReport :: X -> Report -> Overlay
- renderReport :: Report -> T.Text
- findInReport :: (ByteString -> Bool) -> Report -> Maybe ByteString
- lastMsgOfReport :: Report -> (ByteString, Report)
- data History
- emptyHistory :: History
- lengthHistory :: History -> Int
- singletonHistory :: Time -> Report -> History
- addReport :: History -> Time -> Report -> History
- renderHistory :: History -> Overlay
- takeHistory :: Int -> History -> History
- lastReportOfHistory :: History -> Maybe Report
- data Overlay
- emptyOverlay :: Overlay
- truncateToOverlay :: T.Text -> Overlay
- toOverlay :: [T.Text] -> Overlay
- data Slideshow
- splitOverlay :: Bool -> Y -> Overlay -> Overlay -> Slideshow
- toSlideshow :: Bool -> [[T.Text]] -> Slideshow
- encodeLine :: [AttrChar] -> ScreenLine
- encodeOverlay :: [[AttrChar]] -> Overlay
- type ScreenLine = U.Vector Int32
- toScreenLine :: T.Text -> ScreenLine
- splitText :: X -> T.Text -> [T.Text]
Documentation
makePhrase :: [MU.Part] -> T.Text Source
Re-exported English phrase creation functions, applied to default irregular word sets.
makeSentence :: [MU.Part] -> T.Text Source
Re-exported English phrase creation functions, applied to default irregular word sets.
truncateMsg :: X -> T.Text -> T.Text Source
Add a space at the message end, for display overlayed over the level map. Also trims (does not wrap!) too long lines. In case of newlines, displays only the first line, but marks the message as partial.
The type of a set of messages to show at the screen at once.
Empty set of messages.
nullReport :: Report -> Bool Source
Test if the set of messages is empty.
singletonReport :: Msg -> Report Source
Construct a singleton set of messages.
prependMsg :: Msg -> Report -> Report Source
splitReport :: X -> Report -> Overlay 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 -> T.Text Source
Render a report as a (possibly very long) string.
findInReport :: (ByteString -> Bool) -> Report -> Maybe ByteString Source
lastMsgOfReport :: Report -> (ByteString, Report) Source
emptyHistory :: History Source
Empty history of reports.
lengthHistory :: History -> Int Source
singletonHistory :: Time -> Report -> History Source
Construct a singleton history of reports.
addReport :: History -> Time -> Report -> History Source
Add a report to history, handling repetitions.
renderHistory :: History -> Overlay Source
Render history as many lines of text, wrapping if necessary.
takeHistory :: Int -> History -> History Source
Take the given prefix of reports from a history.
A series of screen lines that may or may not fit the width nor height of the screen. An overlay may be transformed by adding the first line and/or by splitting into a slideshow of smaller overlays.
truncateToOverlay :: T.Text -> Overlay Source
A few overlays, displayed one by one upon keypress. When displayed, they are trimmed, not wrapped and any lines below the lower screen edge are not visible. If the boolean flag is set, the overlay is displayed over a blank screen, including the bottom lines.
splitOverlay :: Bool -> Y -> Overlay -> Overlay -> Slideshow Source
Split an overlay into a slideshow in which each overlay,
prefixed by msg
and postfixed by moreMsg
except for the last one,
fits on the screen wrt height (but lines may be too wide).
toSlideshow :: Bool -> [[T.Text]] -> Slideshow Source
Declare the list of raw overlays to be fit for display on the screen.
In particular, current Report
is eiter empty or unimportant
or contained in the overlays and if any vertical or horizontal
trimming of the overlays happens, this is intended.
encodeLine :: [AttrChar] -> ScreenLine Source
encodeOverlay :: [[AttrChar]] -> Overlay Source
type ScreenLine = U.Vector Int32 Source
toScreenLine :: T.Text -> ScreenLine Source