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

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Client.UI.Frame

Contents

- Internal operations

Description

Screen frames.

Note that `PointArray.Array` here represents a screen frame and so screen positions are denoted by `Point`, contrary to the convention that `Point` refers to game map coordinates, as outlined in description of `PointSquare` that should normally be used in that role.

Synopsis

- data ColorMode
  - = ColorFull
  - | ColorBW
- type FrameST s = Mutable Vector s Word32 -> ST s ()
- newtype FrameForall = FrameForall {
  - unFrameForall :: forall s. FrameST s
  }
- newtype FrameBase = FrameBase {
  - unFrameBase :: forall s. ST s (Mutable Vector s Word32)
  }
- type Frame = ((FrameBase, FrameForall), (OverlaySpace, OverlaySpace, OverlaySpace))
- type PreFrame3 = (PreFrame, (OverlaySpace, OverlaySpace, OverlaySpace))
- type PreFrames3 = [Maybe PreFrame3]
- type PreFrame = (Vector Word32, FrameForall)
- type PreFrames = [Maybe PreFrame]
- data SingleFrame = SingleFrame {
  - singleArray :: Array AttrCharW32
  - singlePropOverlay :: OverlaySpace
  - singleSquareOverlay :: OverlaySpace
  - singleMonoOverlay :: OverlaySpace
  }
- type OverlaySpace = [(PointUI, AttrString)]
- blankSingleFrame :: ScreenContent -> SingleFrame
- truncateOverlay :: Bool -> Int -> Int -> Bool -> Int -> Bool -> Overlay -> OverlaySpace
- overlayFrame :: Int -> OverlaySpace -> PreFrame -> PreFrame
- truncateAttrLine :: Bool -> Int -> Int -> AttrLine -> AttrString

# Documentation

data ColorMode Source #

Color mode for the display.

Constructors

ColorFull | normal, with full colours
ColorBW | black and white only

#### Instances

Instances details

Eq ColorMode Source # |
Instance details Defined in Game.LambdaHack.Client.UI.Frame Methods (==) :: ColorMode -> ColorMode -> Bool Source # (/=) :: ColorMode -> ColorMode -> Bool Source #

type FrameST s = Mutable Vector s Word32 -> ST s () Source #

newtype FrameForall Source #

Efficiently composable representation of an operation on a frame, that is, on a mutable vector. When the composite operation is eventually performed, the vector is frozen to become a `SingleFrame`.

Constructors

FrameForall |

Fields

- unFrameForall :: forall s. FrameST s

newtype FrameBase Source #

Action that results in a base frame, to be modified further.

Constructors

FrameBase |

Fields

- unFrameBase :: forall s. ST s (Mutable Vector s Word32)

type Frame = ((FrameBase, FrameForall), (OverlaySpace, OverlaySpace, OverlaySpace)) Source #

A frame, that is, a base frame and all its modifications.

type PreFrame3 = (PreFrame, (OverlaySpace, OverlaySpace, OverlaySpace)) Source #

Components of a frame, before it's decided if the first can be overwritten in-place or needs to be copied.

type PreFrames3 = [Maybe PreFrame3] Source #

Sequence of screen frames, including delays. Potentially based on a single base frame.

type PreFrame = (Vector Word32, FrameForall) Source #

A simpler variant of `PreFrame3`.

type PreFrames = [Maybe PreFrame] Source #

A simpler variant of `PreFrames3`.

data SingleFrame Source #

A frame that is padded to fill the whole screen with optional overlays to display in proportional, square and monospace fonts.

Note that we don't provide a list of color-highlighed box positions to be drawn separately, because overlays need to obscure not only map, but the highlights as well, so highlights need to be included earlier.

See the description of `PointSquare` for explanation of why screen coordinates in `singleArray` are `Point` even though they should be `PointSquare`.

Constructors

SingleFrame |

Fields

- singleArray :: Array AttrCharW32
- singlePropOverlay :: OverlaySpace
- singleSquareOverlay :: OverlaySpace
- singleMonoOverlay :: OverlaySpace

#### Instances

Instances details

Show SingleFrame Source # |
Instance details Defined in Game.LambdaHack.Client.UI.Frame Methods showsPrec :: Int -> SingleFrame -> ShowS Source # show :: SingleFrame -> String Source # showList :: [SingleFrame] -> ShowS Source #
Eq SingleFrame Source # |
Instance details Defined in Game.LambdaHack.Client.UI.Frame Methods (==) :: SingleFrame -> SingleFrame -> Bool Source # (/=) :: SingleFrame -> SingleFrame -> Bool Source #

type OverlaySpace = [(PointUI, AttrString)] Source #

blankSingleFrame :: ScreenContent -> SingleFrame Source #

truncateOverlay :: Bool -> Int -> Int -> Bool -> Int -> Bool -> Overlay -> OverlaySpace Source #

Truncate the overlay: for each line, if it's too long, it's truncated and if there are too many lines, excess is dropped and warning is appended. The width, in the second argument, is calculated in characters, not in UI (mono font) coordinates, so that taking and dropping characters is performed correctly.

overlayFrame :: Int -> OverlaySpace -> PreFrame -> PreFrame Source #

Overlays either the game map only or the whole empty screen frame. We assume the lines of the overlay are not too long nor too many.

# Internal operations

truncateAttrLine :: Bool -> Int -> Int -> AttrLine -> AttrString Source #

Add a space at the message end, for display overlayed over the level map. Also trim (do not wrap!) too long lines. Also add many spaces when under longer lines.