# `Cauldron2D.Net.Pages`
[🔗](https://github.com/jaman/cauldron/blob/v0.1.3/cauldron_2d_net/lib/cauldron_2d/net/pages.ex#L1)

The pages around a game's worlds in a browser: a title, a lobby of arenas, the
arena, settings and the guide, from a `Cauldron2D.Client.Game`, as a plug a game
forwards a path to.

    forward "/play", Cauldron2D.Net.Pages, game: MyGame.Client, username: &MyGame.Web.Auth.username/1, token: &MyGame.Web.Auth.token/1, login: "/login"

The pages also serve the atlas as `atlas.png`, `cauldron.js` and `phoenix.min.js`,
and `arenas.json` for the lobby to refresh from. Links follow the path the pages are
mounted at. The arena page mounts `cauldron.js` on the game's channel with the
player's settings — the preset and the levels, kept in the browser by the settings
page — and shows the round's end over the canvas with a way back to the lobby.

## Options

  * `:game` — the module. Required
  * `:username` — a function from the conn to the player's name, or `nil` when
    nobody is signed in. Default: the conn's `:username` assign
  * `:token` — a function from the conn to the token the socket connects with, sent as
    the `token` socket param. Default: none
  * `:login` — where to send a visitor with no name. Default: none, the page says so
  * `:socket` — the socket's path. Default `"/socket"`
  * `:topic` — the channel topic prefix, as `Cauldron2D.Net.Channel` takes it.
    Default `"world"`
  * `:scale` — pixels a tile on the canvas. Default `32`

# `assigned_username`

```elixir
@spec assigned_username(Plug.Conn.t()) :: String.t() | nil
```

The default `:username`: the conn's `:username` assign.

# `no_token`

```elixir
@spec no_token(Plug.Conn.t()) :: nil
```

The default `:token`: none.

---

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