# gizgame/play2d

2D: a game drawn from its kinds' looks and its picture (Picture2D).

```gizlang
import * as Play2d from "gizgame/play2d";
```

## Types

### `Layer2D`

```gizlang
type Layer2D = (picture: Picture, canvas: mut Canvas2D, sprites: Sprites) => void throws string
```

A part of a 2D picture: drawn into the arena's CANVAS, under or over the actors (Stage2D).

### `Stage2D`

```gizlang
type Stage2D = { under?: Layer2D; over?: Layer2D; hud?: Vec<Widget>; walls?: (game: Game) => Vec<Segment2D>; }
```

What a 2D game's code adds to its picture (play2D; the picture's data is the world's, Picture2D): UNDER before the
actors and OVER after them and the particles, HUD's widgets (play2D draws the title, pause and end panels over them),
and the WALLS that cast shadows in a dark arena.

- `under`: `_gizlang_sdk_core.Option<(arg0: Ref<M213.Picture>, arg1: mut gizlang_draw.Canvas2D, arg2: Ref<M228.Sprites>) => void throws string>`
- `over`: `_gizlang_sdk_core.Option<(arg0: Ref<M213.Picture>, arg1: mut gizlang_draw.Canvas2D, arg2: Ref<M228.Sprites>) => void throws string>`
- `hud`: `_gizlang_sdk_core.Option<Vec<(arg0: Ref<M202.Hud>) => void throws string>>`
- `walls`: `_gizlang_sdk_core.Option<(arg0: Ref<M201.Game>) => Vec<gizlang_draw.Segment2D>>`

## Functions

### `play2D`

```gizlang
function play2D(game: Game, stage: Stage2D = {}): Play<Sprites>
```

A 2D game drawn from its kinds' looks and its picture (Picture2D), with what STAGE adds.

Effects: fail, read, write, io, alloc.

