Overview
This section is the specification of the surface Simple 2D exposes: the types, functions, and methods an implementation of the engine provides, with their parameters, return values, defaults, and error conditions. An implementer satisfies these pages; a game and a validator read them as reference.
Entry point
Section titled “Entry point”The package @clockwyrks/simple-2d has one entry point.
| Specifier | Provides |
|---|---|
@clockwyrks/simple-2d | createEngine, the clocks, TOUCH_LAYOUTS, the viewport functions, RECORDING_FORMAT, and every type a game names. |
A game and a validator both import it. A validator constructs the engine over the
game’s own module, installs a scripted
clock, and steps it with engine.advance, so
the surface a validator exercises is the surface the game was written against.
| Page | Covers |
|---|---|
| Engine | createEngine, EngineOptions, SurfaceMetrics, and the Engine object’s lifecycle, state, and apply. |
| Game | Game, Transition, DeepReadonly, the scoped InitApi, UpdateApi, and RenderApi, the debug surface a game returns beside its state, EngineEvents, and FrameInfo. |
| Clocks | The Clock interface and the five clocks a run’s deltas can come from. |
| Viewport | Viewport, fitViewport, applyViewport, syncCanvas, and the logical-to-device mapping. |
| Input | Action registration, ActionBinding, the read methods, the pointer, and TOUCH_LAYOUTS. |
| Audio | CueSpec, synthesized and file-based cues, looping, and the mute and unlock calls. |
| Assets | loadImage, loadAudio, load, resolve, and the asset root. |
| Diagnostics | Source registration, the values a read returns, the overlay, and its toggle. |
| Recording | The recorder’s engine members, Recording, RecordedFrame, DrawState, DrawOp, and DrawValue. |