Overview
This section is the specification of the surface Structured 2D exposes: the types, classes, 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/structured-2d has one entry point.
| Specifier | Provides |
|---|---|
@clockwyrks/structured-2d | createEngine, the framework classes, the built-in components, the clocks, TOUCH_LAYOUTS, the viewport functions, RECORDING_FORMAT, and every type a game or a validator names. |
A game and a validator both import it. A validator constructs the engine over
the build’s own game definition, installs a scripted
clock, steps it with engine.advance,
and reads the world and the debug surface back off the engine it holds, so the
surface a validator exercises is the surface the game was written against.
| Page | Covers |
|---|---|
| Engine | createEngine, EngineOptions, SurfaceMetrics, RunOptions, FrameInfo, the Engine object’s lifecycle, and EngineEvents with its event map. |
| Game Instance | GameDefinition, GameInstance, the InitApi its initialize receives, and the debug surface it returns. |
| Worlds | LevelDefinition, ActorSpec, LoadApi, the World object, its timers, and the transition sequence. |
| Game Mode | GameMode, GameState, PlayerState, MatchPhase, and the player and bot calls. |
| Actors | Actor, Pawn, Transform, the tag calls, and the deferred destroy. |
| Components | Component and the built-in render, sprite, shape, text, draw, and camera components. |
| Controllers | Controller, PlayerController, AIController, InputReader, and possession. |
| Rendering | Renderer, RenderMode, the collision overlay switch, and the pipeline’s ordering. |
| Collision | ColliderComponent, CollisionResponse, CollisionWorld, Manifold, and the queries. |
| Camera | Camera, CameraSnapshot, Viewport, fitViewport, applyViewport, syncCanvas, and the three spaces. |
| Clocks | The Clock interface and the five clocks a run’s deltas can come from. |
| Input | Action registration, ActionBinding, the read methods, the pointer, and TOUCH_LAYOUTS. |
| Audio | CueSpec, WorldAudio, synthesized and file-backed cues, looping, and the mute and unlock calls. |
| Assets | loadImage, loadAudio, load, resolve, and the asset root. |
| Diagnostics | Source registration on the instance and the world, the values a read returns, FrameMetrics, the overlay, and its toggle. |
| Recording | The recorder’s engine members, Recording, RecordedFrame, DrawState, DrawOp, and DrawValue. |