Quick Reference
Getting Information 2
| color() | A side's color: the project's own (colors, by side) where it gives one, else the stock one. |
| resolve() | What a unit stands as. |
Checks (True / False) 1
| hasOwn() | Whether an event page shows something of its own: a character picture, a tile, or a model (model: its spec). |
Updating & Drawing 2
| drawArt() | Draws art (L.art) from source (the whole picture: an image or a canvas) onto a 2D context, filling w by h pix… |
| drawFigure() | A plain figure in a side's color, on a 2D canvas context, inside the box at (x, y) of width by height pixels:… |
Other 9
| shade() | hex moved toward white (amount above 0) or toward black (below 0), as an rgb() color. |
| unitCharacter() | An enemy's <unit character: Name, index> note as { characterName, characterIndex } (no index: 0); null when t… |
| ownCharacter() | An enemy's rrBattle.character ({ name, index }, what the Database's card stores) as { characterName, characte… |
| recordCharacter() | The character sheet a record gives its units: an actor's own; an enemy's own setting, else its note tag. |
| fit() | The size a picture of width by height pixels is drawn at to fit the tiles a unit's picture takes: TILES_WIDE… |
| modelFit() | What a flat map's picture of a model tall tiles high is scaled by so a unit one tile big stands no taller tha… |
| trim() | The box of a picture's art inside its margin (data: RGBA, width by height): { x, y, width, height }; null whe… |
| art() | The art of a picture as a unit stands as it, from its box (trim) in RGBA pixels data, width pixels a row: { w… |
| rotateHue() | Turns the hue of RGBA pixels by hue degrees, in place: what a battler's hue does to its picture in a battle. |
Getting Information
color
static sourceL.color(team, colors)
A side's color: the project's own (colors, by side) where it gives one, else the stock one.
Details
A side's color: the project's own (colors, by side) where it gives one, else the stock one. An unknown side is a bystander.
resolve
static sourceL.resolve(unit, sources)
What a unit stands as.
Details
What a unit stands as. unit is { team, record: 'actor' | 'enemy' | '', id }.
sources holds what the caller knows:
own the event shows a picture or a model of its own (hasOwn)
model the model the Database binds to the record (its spec, with a name)
record the actor or enemy record
sideView the game's battles are side view
colors the sides' colors, where the project has its own
exists exists(folder, name): false for a picture file that is not there
('characters', 'enemies', 'sv_enemies'); left out, a named picture is taken as there
Returns { kind, team, color } and, by kind: spec (model); characterName,
characterIndex (character); folder, name, hue (picture).
Checks (True / False)
hasOwn
static sourceL.hasOwn(image, model)
Whether an event page shows something of its own: a character picture, a tile, or a model (model: its spec).
Updating & Drawing
drawArt
static sourceL.drawArt(context, source, box, art, w, h)
Draws art (L.art) from source (the whole picture: an image or a canvas) onto a 2D context, filling w by h pixels at (0, 0).
Details
Draws art (L.art) from source (the whole picture: an image or a canvas) onto a 2D context, filling w by h pixels at (0, 0).
drawFigure
static sourceL.drawFigure(context, x, y, width, height, color)
A plain figure in a side's color, on a 2D canvas context, inside the box at (x, y) of width by height pixels: a head over a body that widens to the ground, its feet on the middle of the box's bottom edge.
Details
A plain figure in a side's color, on a 2D canvas context, inside the
box at (x, y) of width by height pixels: a head over a body that
widens to the ground, its feet on the middle of the box's bottom edge.
What a unit with no picture anywhere stands as.
Other
shade
static sourceL.shade(hex, amount)
hex moved toward white (amount above 0) or toward black (below 0), as an rgb() color.
Details
hex moved toward white (amount above 0) or toward black (below 0), as an rgb() color.
unitCharacter
static sourceL.unitCharacter(note)
An enemy's <unit character: Name, index> note as { characterName, characterIndex } (no index: 0); null when the note has none.
ownCharacter
static sourceL.ownCharacter(record)
An enemy's rrBattle.character ({ name, index }, what the Database's card stores) as { characterName, characterIndex }; null when it has none.
recordCharacter
static sourceL.recordCharacter(unit, record)
The character sheet a record gives its units: an actor's own; an enemy's own setting, else its note tag.
Details
The character sheet a record gives its units: an actor's own; an enemy's own setting, else its note tag. Null when it gives none.
fit
static sourceL.fit(width, height, tileWidth, tileHeight, size)
The size a picture of width by height pixels is drawn at to fit the tiles a unit's picture takes: TILES_WIDE wide and TILES_TALL tall on tiles of tileWidth by tileHeight pixels, times size for a unit whose typed size is that many tiles wide.
Details
The size a picture of width by height pixels is drawn at to fit
the tiles a unit's picture takes: TILES_WIDE wide and TILES_TALL tall
on tiles of tileWidth by tileHeight pixels, times size for a unit
whose typed size is that many tiles wide. A small picture grows and a
large one shrinks; its proportions stay. { scale, width, height }, the
size in whole pixels.
modelFit
static sourceL.modelFit(tall, size)
What a flat map's picture of a model tall tiles high is scaled by so a unit one tile big stands no taller than a unit's picture (TILES_TALL tiles, times size for a typed size): never enlarged, never under a fifth.
trim
static sourceL.trim(data, width, height)
The box of a picture's art inside its margin (data: RGBA, width by height): { x, y, width, height }; null when all of it is clear.
Details
The box of a picture's art inside its margin (data: RGBA, width by height): { x, y, width, height }; null when all of it is clear.
art
static sourceL.art(data, width, box)
The art of a picture as a unit stands as it, from its box (trim) in RGBA pixels data, width pixels a row: { width, height, parts: [{ y, height }], gap }.
Details
The art of a picture as a unit stands as it, from its box (trim) in RGBA pixels data, width pixels a
row: { width, height, parts: [{ y, height }], gap }. The parts are the box's rows to draw, top to bottom,
gap empty rows apart; the tallest empty band, when it parts the art, is drawn GAP_KEEP of it tall, so a
creature that flies stands just over its shadow and inside its own cell.
rotateHue
static sourceL.rotateHue(data, hue)
Turns the hue of RGBA pixels by hue degrees, in place: what a battler's hue does to its picture in a battle.