Documentation ¶
Overview ¶
Package mechdevoir collects certain high level UI commands from clients and distributes some associated world state affected by these commands.
The semantic meaning of these UI commands is already standardised and known before they are sent to the server. Examples include pause, play, and shutdown. The UI elements for these commands will normally be visually distinct from a Mechane world's own UI elements, for example this may be accomplished by locating them on an exclusive sidebar.
UI events such as keyboard key events, mouse move events, and ShutterbugPixels' overlayer clicks are dealt with by a different package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDevoirHandleFunc ¶
func NewDevoirHandleFunc( dvr *Devoir, shutterbugs mechshutterbug.Containser, ) http.HandlerFunc
NewDevoirHandleFunc creates a HTTP request handler for receiving UI commands and sending out some world state useful to the UI.
The handler upgrades the HTTP request to a websocket. The websocket's first ever incoming message should be a valid shutterbug.
Types ¶
type Devoir ¶
A Devoir collects certain UI commands from clients and also distrubutes some world state events to clients.
func NewDevoir ¶
func NewDevoir(l *log.Logger, spec InitialState) *Devoir
NewDevoir constructs a new Devoir.
func (*Devoir) Paused ¶
func (dvr *Devoir) Paused()
Paused lets clients know the new play/pause state is paused.
func (*Devoir) Playing ¶
func (dvr *Devoir) Playing()
Playing lets clients know the new play/pause state is playing.
func (*Devoir) RemoveShutterbug ¶
RemoveShutterbug from the devoir closing the associated HTTP request handlers using that shutterbug.
type InitialState ¶
type InitialState struct {
IsPaused bool
}
InitialState specifies the initial world state used by the Devoir.
type PauseUIC ¶
type PauseUIC struct {
UICommand string
}
PauseUIC is sent by a client to pause the world.
func NewPauseUIC ¶
func NewPauseUIC() PauseUIC
type PlayUIC ¶
type PlayUIC struct {
UICommand string
}
PlayUIC is sent by a client to un-pause the world.
func NewPlayUIC ¶
func NewPlayUIC() PlayUIC
type ShutdownUIC ¶
type ShutdownUIC struct {
UICommand string
}
ShutdownUIC is sent by a client to shutdown the world.
func NewShutdownUIC ¶
func NewShutdownUIC() ShutdownUIC