iterators

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: LGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BadID types.EntityID = math.MaxUint64

	ErrEntityDoesNotExist                = errors.New("entity does not exist")
	ErrComponentAlreadyOnEntity          = errors.New("component already on entity")
	ErrComponentNotOnEntity              = errors.New("component not on entity")
	ErrEntityMustHaveAtLeastOneComponent = errors.New("entities must have at least 1 component")
	ErrMustRegisterComponent             = errors.New("must register component")

	// ErrComponentMismatchWithSavedState is an error that is returned when a ComponentID from
	// the saved state is not found in the passed in list of components.
	ErrComponentMismatchWithSavedState = errors.New("registered components do not match with the saved state")
)

Functions

This section is empty.

Types

type ArchetypeIterator

type ArchetypeIterator struct {
	Current int
	Values  []types.ArchetypeID
}

func (*ArchetypeIterator) HasNext

func (it *ArchetypeIterator) HasNext() bool

func (*ArchetypeIterator) Next

func (it *ArchetypeIterator) Next() types.ArchetypeID

type EntityIterator

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

EntityIterator is an iterator for Ent lists in archetypes.

func NewEntityIterator

func NewEntityIterator(current int, archAccessor HasEntitiesForArchetype, indices []types.ArchetypeID) EntityIterator

NewEntityIterator returns an iterator for Entitys.

func (*EntityIterator) HasNext

func (it *EntityIterator) HasNext() bool

HasNext returns true if there are more Ent list to iterate over.

func (*EntityIterator) Next

func (it *EntityIterator) Next() ([]types.EntityID, error)

Next returns the next Ent list.

type HasEntitiesForArchetype

type HasEntitiesForArchetype interface {
	GetEntitiesForArchID(archID types.ArchetypeID) ([]types.EntityID, error)
}

Jump to

Keyboard shortcuts

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