# Input

| Button | Keys |
| --- | --- |
| `up / down / left / right` | arrows, WASD |
| `a` | J, Z, Space, Enter |
| `b` | K, X |
| `x` | U |
| `y` | I |

```js
input.down('right')    // held
input.pressed('a')     // first tick only
input.repeat('left')   // first tick, then while held
input.vector()         // {x, y}, diagonal normalized
```

`repeat(key, delay = 0.3, interval = 0.1)`, seconds. A tap between ticks still counts once in `pressed`.

## On-screen controls

```js
const game = {
  controls: {directions: false, buttons: ['a']},
  // init / step / draw
}
```

`directions` shows the pad. `buttons` lists `a / b / x / y`. Omit to show all. `buttons: []` hides buttons, `controls: false` hides everything. Keyboard input is unaffected.

## Standalone HTML

```js
player.setInput('a', true, 'pad')
player.setInput('a', false, 'pad')
player.release()
GameLib.gameControls(game) // controls with defaults filled in
```

The third argument names the input source; releasing one source keeps another held.

## Controller patterns

`controls: {pattern: 'single'}` shows a large J button in the bottom center without a directional pad. `pattern: 'standard'` uses the standard layout. A single-button layout can select a different action with `buttons: ['b']`; it requires exactly one button. Both sample pages and shared games use the declared pattern.
