ExPilot.Wx (ExPilot v0.1.1)

Copy Markdown View Source

ExPilot in a window, played with the keys or the mouse: the title, the lobby, the arena, the summary, the settings, a connect screen and a serve screen, every one drawn on the same canvas (ExPilot.Wx.Screens on Cauldron2D.Wx.Text), the arena on Cauldron2D.Wx.View.

ExPilot.Wx.run(fields: %{name: "alice"})

l on the title or in the lobby shows the leaders: the boards of the place the lobby lists (this app's, a server's over GET /api/leaders, a node's), / the period, Tab the metric. Enter on the title plays here: the arenas this app carries, with their robots, no set-up. c connects elsewhere — a server by its URL (a token from POST /api/token, the arenas over its WebSocket) or a node this one connects to (its worlds joined across the connection, its maps adopted here) — and the lobby then lists that place's arenas. s is the settings: the effects and music levels and whether the pointer steers, the desktop's own (Cauldron2D.Drafter.Client.Settings with the kind :desktop, in <name>.desktop.settings) and applied to the arena as they change. h is the serve screen: ExPilot.Server with the ports, interfaces, accounts file and robots typed in, for players on other machines.

Keys

Title: Enter play here, c connect, l leaders, s settings, h host a server, q or Esc quit. Connect: / where, / or Tab field, typing fills the field in, Enter the chosen action (or the next field), Esc title. Lobby: /, PgUp/PgDn, Home/End, Enter join, w watch, t team, s settings, r refresh, c connect elsewhere, Esc title. Arena: the game's keys, +/- or the wheel zoom the view in and out — out as far as the whole arena — and 0 puts it back; watching, the arrows or a drag pan it, the wheel zooms about the pointer and 0 recentres it; m shows the frames and draws a second in the corner and hides them again, Tab the settings with the ship left where it is, Esc or q leaves for the lobby. Settings: / choose, / change a level or the switch, Enter the switch, Esc back where it was opened from. Summary: Enter again, Esc lobby, q title. Serve: Enter starts or stops (the first row), reaches the settings, typed as on connect, Esc title. Every item on a screen can be clicked instead.

Options

  • :fields — values for fields by key (:url, :name, :node, :cookie…), over the defaults
  • :size — the window, default {1320, 800}

Summary

Functions

Open the window and block until it is closed.

The starfield behind the screens: Cauldron2D.Wx.Text's backdrop.

Functions

run(opts \\ [])

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

Open the window and block until it is closed.

Closing leaves any match, stops a hosted server, and destroys the window before the process ends; then the wx environment is closed and the wx thread is made to finish that teardown before this returns, so a caller may exit the VM at once.

stars(dc, width, height)

@spec stars(term(), pos_integer(), pos_integer()) :: :ok

The starfield behind the screens: Cauldron2D.Wx.Text's backdrop.