Copyright | Brent Yorgey |
---|---|
License | BSD-3-Clause |
Maintainer | byorgey@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Utilities for describing how to display in-game entities in the TUI.
Synopsis
- type Priority = Int
- data Display
- defaultChar :: Lens' Display Char
- orientationMap :: Lens' Display (Map Direction Char)
- curOrientation :: Lens' Display (Maybe Direction)
- displayAttr :: Lens' Display AttrName
- displayPriority :: Lens' Display Priority
- invisible :: Lens' Display Bool
- displayChar :: Display -> Char
- renderDisplay :: Display -> Widget n
- hidden :: Display -> Display
- defaultTerrainDisplay :: Char -> AttrName -> Display
- defaultEntityDisplay :: Char -> Display
- defaultRobotDisplay :: Display
The display record
Display priority. Entities with higher priority will be drawn on top of entities with lower priority.
A record explaining how to display an entity in the TUI.
Instances
Fields
orientationMap :: Lens' Display (Map Direction Char) Source #
For robots or other entities that have an orientation, this map
optionally associates different display characters with
different orientations. If an orientation is not in the map,
the defaultChar
will be used.
curOrientation :: Lens' Display (Maybe Direction) Source #
The display caches the current orientation of the entity, so we know which character to use from the orientation map.
displayPriority :: Lens' Display Priority Source #
This entity's display priority. Higher priorities are drawn on top of lower.
Rendering
displayChar :: Display -> Char Source #
Look up the character that should be used for a display.
renderDisplay :: Display -> Widget n Source #
Render a display as a UI widget.
Modify a display to use a ?
character for entities that are
hidden/unknown.
Construction
defaultTerrainDisplay :: Char -> AttrName -> Display Source #
The default way to display some terrain using the given character and attribute, with priority 0.
defaultEntityDisplay :: Char -> Display Source #
Construct a default display for an entity that uses only a single display character, the default entity attribute, and priority 1.
defaultRobotDisplay :: Display Source #
Construct a default robot display for a given orientation, with
display characters "X^>v<"
, the default robot attribute, and
priority 10.
Note that the defaultChar
is used for direction DDown
and is overriden for the special base robot.