# `Cauldron2D.Wx.Client`
[🔗](https://github.com/jaman/cauldron/blob/v0.1.3/cauldron_2d_wx/lib/cauldron_2d/wx/client.ex#L1)

The window that puts a game's worlds in front of one player: a title, a lobby of
arenas, settings, the arena, a summary, the guide and the game's own pages, from a
`Cauldron2D.Client.Game` — the desktop's twin of the terminal's
`Cauldron2D.Drafter.Client`.

    Cauldron2D.Wx.Client.run(game: MyGame.Client, username: "alice")

The arena is a `Cauldron2D.Wx.View` joined through a link the `:link` function gives
for the chosen arena: without one, a local link to the arena's world — a name on this
node, or `{module, opts}` for a world of the player's own, started for them and
stopped when they leave. Settings — the key preset, the effects and music levels,
whether the pointer aims — are kept per player under
`Cauldron2D.Paths.config(atlas, "<player>.desktop.settings")`.

## Keys

Title: `Enter` play (into the lobby, or straight into the first arena for a game
whose `lobby?/0` is false), `s` settings, `h` guide, a page's key, `q` or `Esc` quit.
Lobby: `↑`/`↓`, `PgUp`/`PgDn`, `Home`/`End`, `Enter` join, `w` watch, `t` team, `s`
settings, `h` guide, `Esc` title. Settings: `↑`/`↓` choose, `←`/`→` change, `Esc`
back. Arena: the game's keys, `p` pauses a world of the player's own, `Tab` settings
with the world left where it is, `Esc` or `q` leaves. Summary: `Enter` again or on,
as the outcome's `:next` says, `Esc` lobby. Guide and pages: `↑`/`↓`, `Esc` back.
Every item on a screen can be clicked instead.

## Options

  * `:game` — the module. Required
  * `:username` — the player's name. Default `"player"`
  * `:props` — the props the game's `arenas/1`, `pages/1` and `sink/1` are given.
    Default `%{}`
  * `:link` — a function from an arena to the link the view joins with, `{:local,
    opts}` or `{:socket, opts}`. Default: a local link to the arena's world
  * `:size` — the window. Default `{1320, 800}`
  * `:scale` — pixels a sheet pixel in the arena. Default `2`
  * `:backdrop` — drawn behind the screens, as `Cauldron2D.Wx.Text` takes it

# `run`

```elixir
@spec run(keyword()) :: :ok
```

Open the window and block until it is closed.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
