Scriber.Renderer (Scriber v0.1.2)

Copy Markdown View Source

How the map is drawn, layered over Cauldron2D.Renderer.

Two settings select a rendering mode, in order of precedence:

  1. the SCRIBER_MODE environment variable
  2. config :scriber, :mode

Either may be pixel, text, or the name of a specific pixel protocol. When neither is set the engine resolves the mode itself from CAULDRON_MODE, its own config, and the terminal's capabilities.

Example

System.put_env("SCRIBER_MODE", "text")
Scriber.Renderer.mode()
#=> :text

Summary

Functions

A one-line description of the resolved mode and protocol, for the status bar.

Whether the map is drawn as an image (:pixel) or as characters (:text).

The mode selected by SCRIBER_MODE or config :scriber, :mode.

The pixel protocol the map is drawn with, or nil in text mode.

Functions

describe()

@spec describe() :: String.t()

A one-line description of the resolved mode and protocol, for the status bar.

mode()

@spec mode() :: :pixel | :text

Whether the map is drawn as an image (:pixel) or as characters (:text).

override()

@spec override() :: atom() | nil

The mode selected by SCRIBER_MODE or config :scriber, :mode.

Returns nil when neither is set, or when config :scriber, :mode holds a non-atom, which leaves the mode for the engine to resolve. Every other function in this module passes this value to Cauldron2D.Renderer.

protocol()

@spec protocol() :: atom() | nil

The pixel protocol the map is drawn with, or nil in text mode.