The further players a client plays on the same machine, from the game's
local_seats/1: each a player of the world with its own keys and its own controller.
A seat is %{id, input, pad, device, last_input}, device what the seat last played
with: :keyboard, or {:pad, name} with the name its controller connected under. Seats join the world with frames: false,
so the client receives frames only as its own player; each key event reaches every
seat's input and counts where that seat's keymap binds it; a controller event reaches
the one seat it is routed to. send_input/3 sends a seat's input only when it changed.
Summary
Functions
Seat index (counting from 0) after a controller event.
Every seat's input with its timed holds expired at now.
The seats keymaps describe, joined to world as "<username> 2" and on. A seat
the world refuses is left out. props are the player's own join props, given to each
seat with its own :username and with :seat_of, the player's own username, so the
world can tell whose seat it is; input_options are those of the player's own input.
Every seat's input after a key or pointer event at now; a seat whose keymap binds
the key plays with the keyboard from then on.
Whether the key event event is one input binds.
Every seat out of world.
The device after controller event event from the controller named name: that controller, unless the event is its going away.
Every seat holding nothing, its keys read by the keymap it had.
Every seat whose input changed sent to world, its read input passed through steer
first, as the client steers its own player's.
Types
@type seat() :: %{ id: String.t(), input: Cauldron2D.Input.t(), pad: Cauldron2D.Input.Pad.t(), device: :keyboard | {:pad, String.t() | nil}, last_input: map() | nil }
Functions
Seat index (counting from 0) after a controller event.
Every seat's input with its timed holds expired at now.
@spec join( GenServer.server(), String.t(), map(), [Cauldron2D.Input.keymap()], Cauldron2D.Input.Pad.padmap(), keyword() ) :: [seat()]
The seats keymaps describe, joined to world as "<username> 2" and on. A seat
the world refuses is left out. props are the player's own join props, given to each
seat with its own :username and with :seat_of, the player's own username, so the
world can tell whose seat it is; input_options are those of the player's own input.
Every seat's input after a key or pointer event at now; a seat whose keymap binds
the key plays with the keyboard from then on.
@spec keyed?(Cauldron2D.Input.t(), term()) :: boolean()
Whether the key event event is one input binds.
@spec leave([seat()], GenServer.server()) :: :ok
Every seat out of world.
@spec pad_device(:keyboard | {:pad, String.t() | nil}, map(), String.t() | nil) :: :keyboard | {:pad, String.t() | nil}
The device after controller event event from the controller named name: that controller, unless the event is its going away.
@spec release([seat()], [Cauldron2D.Input.keymap()], keyword()) :: [seat()]
Every seat holding nothing, its keys read by the keymap it had.
@spec send_input([seat()], GenServer.server(), (map() -> map())) :: [seat()]
Every seat whose input changed sent to world, its read input passed through steer
first, as the client steers its own player's.