world

package
v4.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2018 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 Event

type Event struct {
	Type    EventType
	Payload interface{}
}

ffjson: nodecoder

func (*Event) MarshalJSON

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

MarshalJSON marshal bytes to json - template

func (*Event) MarshalJSONBuf

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

MarshalJSONBuf marshal buff to json - template

type EventType

type EventType uint8
const (
	EventTypeError EventType = iota
	EventTypeObjectCreate
	EventTypeObjectDelete
	EventTypeObjectUpdate
	EventTypeObjectChecked
)

func (EventType) MarshalJSON

func (event EventType) MarshalJSON() ([]byte, error)

func (EventType) String

func (event EventType) String() string

type World

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

func NewWorld

func NewWorld(width, height uint8) (*World, error)

func (*World) CreateObject

func (w *World) CreateObject(object interface{}, location engine.Location) error

func (*World) CreateObjectAvailableDots

func (w *World) CreateObjectAvailableDots(object interface{}, location engine.Location) (engine.Location, error)

func (*World) CreateObjectRandomByDotsMask

func (w *World) CreateObjectRandomByDotsMask(object interface{}, dm *engine.DotsMask) (engine.Location, error)

func (*World) CreateObjectRandomDot

func (w *World) CreateObjectRandomDot(object interface{}) (engine.Location, error)

func (*World) CreateObjectRandomRect

func (w *World) CreateObjectRandomRect(object interface{}, rw, rh uint8) (engine.Location, error)

func (*World) CreateObjectRandomRectMargin

func (w *World) CreateObjectRandomRectMargin(object interface{}, rw, rh, margin uint8) (engine.Location, error)

func (*World) DeleteObject

func (w *World) DeleteObject(object interface{}, location engine.Location) error

func (*World) Events

func (w *World) Events(stop <-chan struct{}, buffer uint) <-chan Event

func (*World) GetObjectByDot

func (w *World) GetObjectByDot(dot engine.Dot) interface{}

func (*World) GetObjects

func (w *World) GetObjects() []interface{}

func (*World) GetObjectsByDots

func (w *World) GetObjectsByDots(dots []engine.Dot) []interface{}

func (*World) Height

func (w *World) Height() uint8

func (*World) LocationOccupied

func (w *World) LocationOccupied(location engine.Location) bool

func (*World) Navigate

func (w *World) Navigate(dot engine.Dot, dir engine.Direction, dis uint8) (engine.Dot, error)

func (*World) Size

func (w *World) Size() uint16

func (*World) Start

func (w *World) Start(stop <-chan struct{})

func (*World) UpdateObject

func (w *World) UpdateObject(object interface{}, old, new engine.Location) error

func (*World) UpdateObjectAvailableDots

func (w *World) UpdateObjectAvailableDots(object interface{}, old, new engine.Location) (engine.Location, error)

func (*World) Width

func (w *World) Width() uint8

Jump to

Keyboard shortcuts

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