comicPanels.package
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
| Call | Returns | What it does |
|---|---|---|
setLayout(id, opts?) | boolean | Lay 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) | boolean | Change the camera mode and keep the current layout (or splash when none). |
setBorder(style) | boolean | Change the border style; false for an unknown style or when no page is shown. |
setGutter(colour) | boolean | Change the gutter colour; false when no page is shown. |
matchLook() | boolean | Set the extra views' print treatment from TREATMENTS for the look now in the stack (StyleKit.describe().look), or default. |
applyLook(id) | ok, err | StyleKit.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, sources | The 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(throughlayouts()):splash,splashInset,twoUp,threeTier,fourGrid,newspaperStrip,tallSplit,slantedAction,slantedDuel,bleed,bleedInset,bigTopRow.BORDERS:clean0,brush1,rough2,heavy3,none4 (the block'sborderStyle).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) fordefaultand each comicBlocks look.ENTRY("panels"),MAX_PANELS(6),MAX_VIEWS(3),VERSION.
Notes
- Layouts, framings and treatments are module state: a
defineor a change toFRAMINGSmust 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).
applyLooktakes nokeepoption; to keep a Line entry too, callStyleKit.applyLook(id, { keep = { "line", "medium" } })and thenmatchLook().