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

Game.LambdaHack.Client.UI.Overlay

Description

Screen overlays.

Synopsis

DisplayFont

data DisplayFont Source #

Three types of fonts used in the UI. Overlays (layers, more or less) in proportional font are overwritten by layers in square font, which are overwritten by layers in mono font. All overlays overwrite the rendering of the game map, which is the underlying basic UI frame, comprised of square font glyps.

This type needs to be kept abstract to ensure that frontend-enforced or user config-enforced font assignments in FontSetup (e.g., stating that the supposedly proportional font is overriden to be the square font) can't be ignored. Otherwise a programmer could use arbirary DisplayFont, instead of the one taken from FontSetup, and so, e.g., calculating the width of an overlay so constructed in order to decide where another overlay can start would be inconsistent what what font is really eventually used when rendering.

Note that the order of constructors has limited effect, but it illustrates how overwriting is explicitly implemented in frontends that support all fonts.

FontSetup

data FontSetup Source #

Instances

Instances details
Eq FontSetup Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Overlay

Show FontSetup Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Overlay

AttrString

type AttrString = [AttrCharW32] Source #

String of colourful text. End of line characters permitted.

AttrLine

data AttrLine Source #

Line of colourful text. End of line characters forbidden. Trailing White space forbidden.

Instances

Instances details
Eq AttrLine Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Overlay

Show AttrLine Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Overlay

splitAttrString :: Int -> Int -> AttrString -> [AttrLine] Source #

Split a string into lines. Avoid breaking the line at a character other than space. Remove the spaces on which lines are broken, keep other spaces. In expensive assertions mode (dev debug mode) fail at trailing spaces, but keep leading spaces, e.g., to make distance from a text in another font. Newlines are respected.

Note that we only split wrt White space, nothing else, and the width, in the first argument, is calculated in characters, not in UI (mono font) coordinates, so that taking and dropping characters is performed correctly.

Overlay

type Overlay = [(PointUI, AttrLine)] Source #

A series of screen lines with start positions at which they should be overlayed over the base frame or a blank screen, depending on context. The position point is represented as in integer that is an index into the frame character array. The lines either fit the width of the screen or are intended for truncation when displayed. The start positions of lines may fall outside the length of the screen, too, unlike in SingleFrame. Then they are simply not shown.

Internal operations