sector

package
v0.0.0-...-9e256ac Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type World

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

World is an implementation of world.World which divides entities into sectors

func New

func New(radius float32) *World

New creates a new World.

func (*World) AddEntity

func (w *World) AddEntity(entity *world.Entity)

AddEntity adds an entity to the world Cannot add during parallel execution

func (*World) Count

func (w *World) Count() int

func (*World) Debug

func (w *World) Debug()

Debug output

func (*World) EntityByID

func (w *World) EntityByID(entityID world.EntityID, callback func(entity *world.Entity) (remove bool))

EntityByID gets an entity by its id Cannot hold references to entity outside this function

func (*World) ForEntities

func (w *World) ForEntities(callback func(entity *world.Entity) (stop, remove bool)) bool

func (*World) ForEntitiesAndOthers

func (w *World) ForEntitiesAndOthers(entityCallback func(entity *world.Entity) (stop bool, radius float32),
	otherCallback func(entity *world.Entity, otherEntity *world.Entity) (stop, remove, removeOther bool)) bool

ForEntitiesAndOthers TODO support multi-threading

func (*World) ForEntitiesInRadius

func (w *World) ForEntitiesInRadius(position world.Vec2f, radius float32, callback func(r float32, entity *world.Entity) (stop bool)) bool

ForEntitiesInRadius implements world.World.ForEntitiesInRadius For reading only

func (*World) Resize

func (w *World) Resize(radius float32)

func (*World) SetParallel

func (w *World) SetParallel(parallel bool) bool

SetParallel turns on parallel execution mode

Jump to

Keyboard shortcuts

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