How a game's picture (a scene's :picture) reaches a terminal that keeps images: the
size it is drawn at, how each frame is encoded, and whether frames are double
buffered. Options are a list, or a comma-separated string:
native— drawn at the game's own size times the largest whole number that fits the pane, the terminal scaling it to the panenative:N— at the game's own size timesNsize:WxH— the game's own size isWbyHpixels, over what the game declares (a scene's:native, else the look's:native)png— each frame is sent as a PNG, palette when it has at most 256 colours, in place of deflated raw pixelsswap— each frame is stored before the last is let go, so the pane never blanks between framesgpu— a scene that describes itself for the graphics card (a scene's:gpu) is drawn byCauldronGPUat the pane's size in pixels and shown in the pane; other scenes, and every scene when no graphics card opens, are drawn as without itwindow— asgpu, but in a window of its own: keys pressed in the window reach the client as the terminal's do, and the pane is left empty while the window opens and is opensoftware— never the graphics card
Without gpu, window or software the player's drawing setting decides
(Cauldron2D.Drafter.Client.Settings), which by default uses the graphics card in the
pane when there is one.
none— none of these
Without native, or with it when neither the game nor size gives a size, the picture
is drawn at the pane's cells times the surface's density and sent as raw pixels.
options/2 reads a client's options from its mount props (:picture), else the
application env config :cauldron_2d_drafter, picture: ..., else the environment
variable CAULDRON_PICTURE, else the game's look (:picture), else default/0. surface_props/3 turns them into
Cauldron2D.Drafter.Surface props.
iex> Cauldron2D.Drafter.Client.Picture.parse("native:2,png,swap")
{:ok, [{:native, 2}, :png, :swap]}
Summary
Functions
The options used when none are given.
Where options ask for scenes to be drawn: on the graphics card in the pane (:pane)
or a window (:window), never on it (:software), or nil when they do not say.
The options for a client of a game whose look is look, mounted with props: the
:picture prop, else the application env, else CAULDRON_PICTURE, else the look's
:picture, else default/0. Raises ArgumentError when the one found does not parse.
The options a string names, or the list given back, with the first that is not an option as the error.
The :native, :native_scale, :picture_format and :swap props of a
Cauldron2D.Drafter.Surface showing scene under look with options. A scene with a
:gpu is drawn at the pane's own pixels.
Types
@type option() :: :native | {:native, pos_integer()} | {:size, {pos_integer(), pos_integer()}} | :png | :swap | :gpu | :window | :software
Functions
@spec default() :: [option()]
The options used when none are given.
@spec gpu([option()]) :: :pane | :window | :software | nil
Where options ask for scenes to be drawn: on the graphics card in the pane (:pane)
or a window (:window), never on it (:software), or nil when they do not say.
The options for a client of a game whose look is look, mounted with props: the
:picture prop, else the application env, else CAULDRON_PICTURE, else the look's
:picture, else default/0. Raises ArgumentError when the one found does not parse.
The options a string names, or the list given back, with the first that is not an option as the error.
The :native, :native_scale, :picture_format and :swap props of a
Cauldron2D.Drafter.Surface showing scene under look with options. A scene with a
:gpu is drawn at the pane's own pixels.