Skip to content

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.

The package @clockwyrks/simple-2d has one entry point.

SpecifierProvides
@clockwyrks/simple-2dcreateEngine, 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.

PageCovers
EnginecreateEngine, EngineOptions, SurfaceMetrics, and the Engine object’s lifecycle, state, and apply.
GameGame, Transition, DeepReadonly, the scoped InitApi, UpdateApi, and RenderApi, the debug surface a game returns beside its state, EngineEvents, and FrameInfo.
ClocksThe Clock interface and the five clocks a run’s deltas can come from.
ViewportViewport, fitViewport, applyViewport, syncCanvas, and the logical-to-device mapping.
InputAction registration, ActionBinding, the read methods, the pointer, and TOUCH_LAYOUTS.
AudioCueSpec, synthesized and file-based cues, looping, and the mute and unlock calls.
AssetsloadImage, loadAudio, load, resolve, and the asset root.
DiagnosticsSource registration, the values a read returns, the overlay, and its toggle.
RecordingThe recorder’s engine members, Recording, RecordedFrame, DrawState, DrawOp, and DrawValue.