player

package
v4.2.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Type    MessageType `json:"type"`
	Payload interface{} `json:"payload"`
}

ffjson: nodecoder

func NewMessageCountdown

func NewMessageCountdown(countdown uint) Message

func NewMessageError

func NewMessageError(errorStr string) Message

func NewMessageNotice

func NewMessageNotice(notice string) Message

func NewMessageObjects

func NewMessageObjects(objects []interface{}) Message

func NewMessageSize

func NewMessageSize(w, h uint8) Message

func NewMessageSnake

func NewMessageSnake(id world.Identifier) Message

func (*Message) MarshalJSON

func (j *Message) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Message) MarshalJSONBuf

func (j *Message) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

type MessageCountdown

type MessageCountdown uint

type MessageError

type MessageError string

type MessageNotice

type MessageNotice string

type MessageObjects

type MessageObjects []interface{}

type MessageSize

type MessageSize struct {
	Width  uint8 `json:"width"`
	Height uint8 `json:"height"`
}

ffjson: nodecoder

func (*MessageSize) MarshalJSON

func (j *MessageSize) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*MessageSize) MarshalJSONBuf

func (j *MessageSize) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

type MessageSnake

type MessageSnake world.Identifier

type MessageType

type MessageType uint8
const (
	MessageTypeSize MessageType = iota
	MessageTypeSnake
	MessageTypeNotice
	MessageTypeError
	MessageTypeCountdown
	MessageTypeObjects
)

func (MessageType) MarshalJSON

func (t MessageType) MarshalJSON() ([]byte, error)

func (MessageType) String

func (t MessageType) String() string

type Player

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

func NewPlayer

func NewPlayer(logger logrus.FieldLogger, world world.Interface) *Player

func (*Player) Start

func (p *Player) Start(stop <-chan struct{}, chin <-chan string) <-chan Message

Jump to

Keyboard shortcuts

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