Log inGet started
World

Comic Book Looks: Halftone, Ben-Day, Noir Ink and Panels

Branchmain
Branchesmain
Commit79e4166043

README.md

ComicPanels

The module that lays a game's view into comic panels. Game code, setup scripts and agents call it to pick a page layout, a camera mode, a border style and a gutter colour; it writes the panelPage block's settings into the scene's style stack (one entry, id panels, in the Medium slot) and keeps the same choices on a synced ComicPanels entity whose ComicPage component drives each machine's extra cameras.

local ComicPanels = require("~comicPanels.ComicPanels")
ComicPanels.setLayout("threeTier", { cameras = "several", border = "brush", gutter = "cream" })
ComicPanels.setLayout("splash")     -- one camera, one panel
ComicPanels.off()                   -- back to the plain frame

Functions

CallReturnsWhat it does
setLayout(id, opts?)booleanLay the view into layout id. Creates the ComicPanels entity and the panels stack entry the first time, changes them after. opts: cameras ("single" or "several"), border (clean, brush, rough, heavy, none), gutter (a GUTTERS name or "#rrggbb"), borderColour, borderPx, gutterPx, marginPx, viewScale (0.25 to 1), keepBorder (false to drop the border you set before). Camera mode, border and gutter carry over from the last call when left out. false for an unknown layout.
setCameras(mode)booleanChange the camera mode and keep the current layout (or splash when none).
setBorder(style)booleanChange the border style; false for an unknown style or when no page is shown.
setGutter(colour)booleanChange the gutter colour; false when no page is shown.
matchLook()booleanSet the extra views' print treatment from TREATMENTS for the look now in the stack (StyleKit.describe().look), or default.
applyLook(id)ok, errStyleKit.applyLook(id), keeping the Medium slot when a page is shown, then matchLook().
off()Remove the panels entry and mark the page hidden, so every machine drops its extra cameras.
state()table{ layout, cameras, border, gutter, enabled, viewScale } from the synced entity.
define(layout)Add or replace a layout: { id, name, summary, panels = { { corners = { tl, tr, br, bl }, view } }, bleed?, border? }, one to six panels, corners from 0 to 1 with the top left first.
layouts(){ Layout }Every layout, in the order defined.
layout(id)Layout?One layout.
framings(){ string }The camera framing names, sorted.
plan(layoutId, cameras)views, sourcesThe extra views a layout asks for (one per distinct framing, at most three) and which source each panel shows (0 the main view, 1 to 3 an extra view).

Tables

  • LAYOUTS (through layouts()): splash, splashInset, twoUp, threeTier, fourGrid, newspaperStrip, tallSplit, slantedAction, slantedDuel, bleed, bleedInset, bigTopRow.
  • BORDERS: clean 0, brush 1, rough 2, heavy 3, none 4 (the block's borderStyle).
  • GUTTERS: white, cream, newsprint, black, red, blue, yellow, grey.
  • FRAMINGS: closeUp, reverse, wide, lowAngle, overhead, side, each { eye, at, fov, summary } with offsets as (right, up, forward) metres from the player's body.
  • TREATMENTS: the extra views' print treatment (viewInk, viewLevels, viewDots, viewMono, viewScreenPx) for default and each comicBlocks look.
  • ENTRY ("panels"), MAX_PANELS (6), MAX_VIEWS (3), VERSION.

Notes

  • Layouts, framings and treatments are module state: a define or a change to FRAMINGS must run on every machine (in a module or component every peer loads).
  • The extra views get the panel's own print treatment rather than the look's blocks, because the look stack runs only on the presented frame (styleKit Known limit #17427).
  • applyLook takes no keep option; to keep a Line entry too, call StyleKit.applyLook(id, { keep = { "line", "medium" } }) and then matchLook().