debug

package
v0.0.0-...-37a0012 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller manages all streams

func NewController

func NewController() *Controller

NewController returns a controller that mediates new stream connections to a specific GameKey and broadcasts game state across all registered streams for a given GameKey.

func (*Controller) Broadcast

func (sc *Controller) Broadcast(key keys.GameKey, g game.GameState)

Broadcast sends the game state across all connected streams for the given GameKey.

func (*Controller) CreateStream

func (sc *Controller) CreateStream(key keys.GameKey) *Stream

CreateStream will take a proto stream, transform it into a game stream, and register is with the controller. This allows the render loop to send a game's state to all registered streams for the given game's keys.GameKey.

func (*Controller) RemoveStream

func (sc *Controller) RemoveStream(key keys.GameKey, stream *Stream)

RemoveStream stops and deregisters the given stream on the given keys.GameKey so that renders no longer propagate to the stream.

func (*Controller) Stop

func (sc *Controller) Stop()

Stop ends all streams and closes the controller

type Stream

type Stream struct {
	// contains filtered or unexported fields
}

func NewStream

func NewStream() *Stream

func (*Stream) Send

func (s *Stream) Send(key string, g game.GameState) bool

func (*Stream) Stop

func (s *Stream) Stop()

type Streams

type Streams []*Stream

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL