jengine-paint
Paint by numbers three ways - pixel, zones and picross - and Little Easel.
| Kind | Project package: linked into the builds of the projects that list it |
| Source | packages/jengine-paint |
| Version | 0.1.0 |
| Entry point | jengine_paint::PaintPackage |
| Script namespace | Paint |
| Listed by | projects/arcade-classics |
Using it
Section titled “Using it”List it in the top-level "packages" array of project.jengine:
{ "packages": [ { "name": "jengine-paint", "source": { "type": "path", "path": "../../packages/jengine-paint" } } ]}Then rebuild the editor viewport for the project (jengine viewport-build projects/<name>, or the
editor’s Rebuild viewport banner). Native and web builds link it on their own.
A scene that uses its components must be a v2 scene ("version": 2): a v1 scene has no field
for a package component and keeps it as inert custom data.
A script can check that the package is linked with if Paint == nil then return end.
Components
Section titled “Components”| Scene key | Rust type | |
|---|---|---|
le_easel | Easel | package only: needs a v2 scene |
Script commands
Section titled “Script commands”Commands run in every runtime and return nothing; a package publishes what scripts read onto components (see the notes below). The flat name also works.
| Call | Flat name |
|---|---|
Paint.gallery(e, mode, done) | le_gallery |
Paint.open(e, mode, index, saved) | le_open |
Paint.close(e) | le_close |
Paint.pause(e, paused) | le_pause |
Paint.select(e, color) | le_select |
Paint.tool(e, tool) | le_tool |
Paint.undo(e) | le_undo |
Paint.fit(e) | le_fit |
Paint.find(e) | le_find |
Paint.zoom(e, factor) | le_zoom |
Paint.pan(e, dx, dy) | le_pan |
Paint.press(e, x, y) | le_press |
Paint.drag(e, x, y) | le_drag |
Paint.release(e, x, y, moved) | le_release |
Scenes that use it
Section titled “Scenes that use it”projects/arcade-classics/assets/scenes/easel.scene
From packages/jengine-paint/src/lib.rs.
Paint by numbers, three ways - and Little Easel, the arcade’s colouring table.
One picture format (picture) played three ways (play):
- Pixel - every cell carries its colour’s number; paint it.
- Zones - a colouring book: the picture cut into patches
(
zones), each numbered where the number fits best; one tap fills a patch. - Picross - a nonogram whose clues come from the picture, proved
solvable line by line (
nonogram); finish it and it turns into the picture.
This module draws it and plays it. The picture, the palette tray and the
gallery of pictures are entities the package owns. The package reads
input itself (gesture): every finger from InputState::touches and
the mouse otherwise, through the frame’s camera - so two fingers pinch
and pan, one paints (or pans, in Zones), and the mouse wheel and right
button do the same on a desktop. The le_press / le_drag /
le_release commands feed the same path for a test or a host that lends
no input.
One le_easel on a manager entity: the canvas_* and tray_* rects, the
font (with digit_top, digit_height, line_height from
tools/gen_tabletop_font.py), the textures (white, round, disc,
ring, thumbs - an atlas of gallery thumbnails), min_zone, and the
pictures: pixel, zones and picross, each a list of
picture::PictureDef.
Script commands
Section titled “Script commands”| Call | Does |
|---|---|
Paint.gallery(e, mode, done) | show a mode’s pictures; done is "0110...", one flag a picture |
Paint.open(e, mode, index, saved) | play a picture; saved is a save string from before, or "" |
Paint.close(e) | clear the table |
Paint.pause(e, paused) | stop reading the pointer and the clock |
Paint.select(e, color) / Paint.tool(e, "fill" / "cross") | the colour in hand; Picross’s tool |
Paint.undo(e) / Paint.fit(e) / Paint.find(e) | undo a stroke; fit the picture; show where the colour in hand is still wanted |
Paint.zoom(e, factor) / Paint.pan(e, dx, dy) | the view, from keys |
Paint.press(e, x, y) / Paint.drag(e, x, y) / Paint.release(e, x, y) | a pointer, by hand |
What scripts read
Section titled “What scripts read”The le_easel bag: active, mode, index, name, progress,
correct, targets, mistakes, time, solved, colors, selected,
tool, save, counts (pictures per mode), gallery ({ mode, page, pages } while one shows), and events: opened, painted (correct),
color_done, filled, mistake, crossed, line_done, solved,
undone, selected, pick (index).