storage

package
v1.0.3-beta Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BadID entity.ID = math.MaxUint64

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

	// ErrComponentMismatchWithSavedState is an error that is returned when a TypeID 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  []archetype.ID
}

func (*ArchetypeIterator) HasNext

func (it *ArchetypeIterator) HasNext() bool

func (*ArchetypeIterator) Next

func (it *ArchetypeIterator) Next() archetype.ID

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 []archetype.ID) 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() ([]entity.ID, error)

Next returns the next Ent list.

type HasEntitiesForArchetype

type HasEntitiesForArchetype interface {
	GetEntitiesForArchID(archID archetype.ID) ([]entity.ID, error)
}

type MockComponentType

type MockComponentType[T any] struct {
	// contains filtered or unexported fields
}

func NewMockComponentType

func NewMockComponentType[T component.Component](t T, defaultVal interface{}) (*MockComponentType[T], error)

func (*MockComponentType[T]) Decode

func (m *MockComponentType[T]) Decode(bytes []byte) (any, error)

func (*MockComponentType[T]) Encode

func (m *MockComponentType[T]) Encode(a any) ([]byte, error)

func (*MockComponentType[T]) GetSchema

func (m *MockComponentType[T]) GetSchema() []byte

func (*MockComponentType[T]) ID

func (m *MockComponentType[T]) ID() component.TypeID

func (*MockComponentType[T]) Name

func (m *MockComponentType[T]) Name() string

func (*MockComponentType[T]) New

func (m *MockComponentType[T]) New() ([]byte, error)

func (*MockComponentType[T]) SetID

func (m *MockComponentType[T]) SetID(id component.TypeID) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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