generic

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 2 Imported by: 43

Documentation

Overview

Package generic contains Arche's generic API.

See the top level module github.com/mlange-42/arche for an overview.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comp

type Comp reflect.Type

Comp is an alias for component types.

func T

func T[A any]() Comp

T provides a component type from a generic type argument.

func T1

func T1[A any]() []Comp

T1 creates a component type list for one component types.

func T2

func T2[A any, B any]() []Comp

T2 creates a component type list for two component types.

func T3

func T3[A any, B any, C any]() []Comp

T3 creates a component type list for three component types.

func T4

func T4[A any, B any, C any, D any]() []Comp

T4 creates a component type list for four component types.

func T5

func T5[A any, B any, C any, D any, E any]() []Comp

T5 creates a component type list for five component types.

func T6

func T6[A any, B any, C any, D any, E any, F any]() []Comp

T6 creates a component type list for six component types.

func T7

func T7[A any, B any, C any, D any, E any, F any, G any]() []Comp

T7 creates a component type list for seven component types.

func T8

func T8[A any, B any, C any, D any, E any, F any, G any, H any]() []Comp

T8 creates a component type list for eight component types.

type Exchange

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

Exchange is a helper for adding, removing and exchanging components.

Set it up like this:

ex := NewExchange(&world).
          Adds(T3[A, B, C]()...).
          Removes(T2[D, E]()...)

For only adding or removing components, see also Map1, Map2 etc.

func NewExchange

func NewExchange(w *ecs.World) *Exchange

NewExchange creates a new Exchange object.

func (*Exchange) Add

func (m *Exchange) Add(entity ecs.Entity)

Add the components set via Exchange.Adds to the given entity.

See also ecs.World.Add.

func (*Exchange) Adds

func (m *Exchange) Adds(add ...Comp) *Exchange

Adds sets components to add in calls to Exchange.Add and Exchange.Exchange.

Create the required mask items with T.

func (*Exchange) Exchange

func (m *Exchange) Exchange(entity ecs.Entity)

Exchange components on an entity.

Removes the components set via Exchange.Removes. Adds the components set via Exchange.Adds.

See also ecs.World.Exchange.

func (*Exchange) NewEntity

func (m *Exchange) NewEntity() ecs.Entity

NewEntity creates a new ecs.Entity with the components set via Exchange.Adds.

See also ecs.World.NewEntity.

func (*Exchange) Remove

func (m *Exchange) Remove(entity ecs.Entity)

Remove the components set via Exchange.Removes from the given entity.

See also ecs.World.Remove.

func (*Exchange) Removes

func (m *Exchange) Removes(remove ...Comp) *Exchange

Removes sets components to remove in calls to Exchange.Remove and Exchange.Exchange.

Create the required mask items with T.

type Filter0

type Filter0 filter

Filter0 is a helper for building Query0 query iterators.

func NewFilter0

func NewFilter0() *Filter0

NewFilter0 creates a generic Filter0 for zero components.

See also ecs.World.Query.

func (*Filter0) Filter

func (q *Filter0) Filter(w *ecs.World) ecs.MaskFilter

Filter generates and return the ecs.Filter used after Filter0.Query.

Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter0.Query.

func (*Filter0) Query

func (q *Filter0) Query(w *ecs.World) Query0

Query builds a Query0 query for iteration.

func (*Filter0) With

func (q *Filter0) With(mask ...Comp) *Filter0

With adds components that are required, but not accessible via [Query0.Get].

Create the required mask items with T.

func (*Filter0) Without

func (q *Filter0) Without(mask ...Comp) *Filter0

Without excludes entities with any of the given components from the query.

Create the required mask items with T.

type Filter1

type Filter1[A any] filter

Filter1 is a helper for building Query1 query iterators.

func NewFilter1

func NewFilter1[A any]() *Filter1[A]

NewFilter1 creates a generic Filter1 for one components.

See also ecs.World.Query.

func (*Filter1[A]) Filter

func (q *Filter1[A]) Filter(w *ecs.World) ecs.MaskFilter

Filter generates and return the ecs.Filter used after Filter1.Query.

Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter1.Query.

func (*Filter1[A]) Optional

func (q *Filter1[A]) Optional(mask ...Comp) *Filter1[A]

Optional makes some of the query's components optional.

Create the required mask items with T.

Only affects component types that were specified in the query.

func (*Filter1[A]) Query

func (q *Filter1[A]) Query(w *ecs.World) Query1[A]

Query builds a Query1 query for iteration.

func (*Filter1[A]) With

func (q *Filter1[A]) With(mask ...Comp) *Filter1[A]

With adds components that are required, but not accessible via Query1.Get.

Create the required mask items with T.

func (*Filter1[A]) Without

func (q *Filter1[A]) Without(mask ...Comp) *Filter1[A]

Without excludes entities with any of the given components from the query.

Create the required mask items with T.

type Filter2

type Filter2[A any, B any] filter

Filter2 is a helper for building Query2 query iterators.

func NewFilter2

func NewFilter2[A any, B any]() *Filter2[A, B]

NewFilter2 creates a generic Filter2 for two components.

See also ecs.World.Query.

func (*Filter2[A, B]) Filter

func (q *Filter2[A, B]) Filter(w *ecs.World) ecs.MaskFilter

Filter generates and return the ecs.Filter used after Filter2.Query.

Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter2.Query.

func (*Filter2[A, B]) Optional

func (q *Filter2[A, B]) Optional(mask ...Comp) *Filter2[A, B]

Optional makes some of the query's components optional.

Create the required mask items with T.

Only affects component types that were specified in the query.

func (*Filter2[A, B]) Query

func (q *Filter2[A, B]) Query(w *ecs.World) Query2[A, B]

Query builds a Query2 query for iteration.

func (*Filter2[A, B]) With

func (q *Filter2[A, B]) With(mask ...Comp) *Filter2[A, B]

With adds components that are required, but not accessible via Query2.Get.

Create the required mask items with T.

func (*Filter2[A, B]) Without

func (q *Filter2[A, B]) Without(mask ...Comp) *Filter2[A, B]

Without excludes entities with any of the given components from the query.

Create the required mask items with T.

type Filter3

type Filter3[A any, B any, C any] filter

Filter3 is a helper for building Query3 query iterators.

func NewFilter3

func NewFilter3[A any, B any, C any]() *Filter3[A, B, C]

NewFilter3 creates a generic Filter3 for three components.

See also ecs.World.Query.

func (*Filter3[A, B, C]) Filter

func (q *Filter3[A, B, C]) Filter(w *ecs.World) ecs.MaskFilter

Filter generates and return the ecs.Filter used after Filter3.Query.

Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter3.Query.

func (*Filter3[A, B, C]) Optional

func (q *Filter3[A, B, C]) Optional(mask ...Comp) *Filter3[A, B, C]

Optional makes some of the query's components optional.

Create the required mask items with T.

Only affects component types that were specified in the query.

func (*Filter3[A, B, C]) Query

func (q *Filter3[A, B, C]) Query(w *ecs.World) Query3[A, B, C]

Query builds a Query3 query for iteration.

func (*Filter3[A, B, C]) With

func (q *Filter3[A, B, C]) With(mask ...Comp) *Filter3[A, B, C]

With adds components that are required, but not accessible via Query3.Get.

Create the required mask items with T.

func (*Filter3[A, B, C]) Without

func (q *Filter3[A, B, C]) Without(mask ...Comp) *Filter3[A, B, C]

Without excludes entities with any of the given components from the query.

Create the required mask items with T.

type Filter4

type Filter4[A any, B any, C any, D any] filter

Filter4 is a helper for building Query4 query iterators.

func NewFilter4

func NewFilter4[A any, B any, C any, D any]() *Filter4[A, B, C, D]

NewFilter4 creates a generic Filter4 for four components.

See also ecs.World.Query.

func (*Filter4[A, B, C, D]) Filter

func (q *Filter4[A, B, C, D]) Filter(w *ecs.World) ecs.MaskFilter

Filter generates and return the ecs.Filter used after Filter4.Query.

Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter4.Query.

func (*Filter4[A, B, C, D]) Optional

func (q *Filter4[A, B, C, D]) Optional(mask ...Comp) *Filter4[A, B, C, D]

Optional makes some of the query's components optional.

Create the required mask items with T.

Only affects component types that were specified in the query.

func (*Filter4[A, B, C, D]) Query

func (q *Filter4[A, B, C, D]) Query(w *ecs.World) Query4[A, B, C, D]

Query builds a Query4 query for iteration.

func (*Filter4[A, B, C, D]) With

func (q *Filter4[A, B, C, D]) With(mask ...Comp) *Filter4[A, B, C, D]

With adds components that are required, but not accessible via Query4.Get.

Create the required mask items with T.

func (*Filter4[A, B, C, D]) Without

func (q *Filter4[A, B, C, D]) Without(mask ...Comp) *Filter4[A, B, C, D]

Without excludes entities with any of the given components from the query.

Create the required mask items with T.

type Filter5

type Filter5[A any, B any, C any, D any, E any] filter

Filter5 is a helper for building Query5 query iterators.

func NewFilter5

func NewFilter5[A any, B any, C any, D any, E any]() *Filter5[A, B, C, D, E]

NewFilter5 creates a generic Filter5 for five components.

See also ecs.World.Query.

func (*Filter5[A, B, C, D, E]) Filter

func (q *Filter5[A, B, C, D, E]) Filter(w *ecs.World) ecs.MaskFilter

Filter generates and return the ecs.Filter used after Filter5.Query.

Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter5.Query.

func (*Filter5[A, B, C, D, E]) Optional

func (q *Filter5[A, B, C, D, E]) Optional(mask ...Comp) *Filter5[A, B, C, D, E]

Optional makes some of the query's components optional.

Create the required mask items with T.

Only affects component types that were specified in the query.

func (*Filter5[A, B, C, D, E]) Query

func (q *Filter5[A, B, C, D, E]) Query(w *ecs.World) Query5[A, B, C, D, E]

Query builds a Query5 query for iteration.

func (*Filter5[A, B, C, D, E]) With

func (q *Filter5[A, B, C, D, E]) With(mask ...Comp) *Filter5[A, B, C, D, E]

With adds components that are required, but not accessible via Query5.Get.

Create the required mask items with T.

func (*Filter5[A, B, C, D, E]) Without

func (q *Filter5[A, B, C, D, E]) Without(mask ...Comp) *Filter5[A, B, C, D, E]

Without excludes entities with any of the given components from the query.

Create the required mask items with T.

type Filter6

type Filter6[A any, B any, C any, D any, E any, F any] filter

Filter6 is a helper for building Query6 query iterators.

func NewFilter6

func NewFilter6[A any, B any, C any, D any, E any, F any]() *Filter6[A, B, C, D, E, F]

NewFilter6 creates a generic Filter6 for six components.

See also ecs.World.Query.

func (*Filter6[A, B, C, D, E, F]) Filter

func (q *Filter6[A, B, C, D, E, F]) Filter(w *ecs.World) ecs.MaskFilter

Filter generates and return the ecs.Filter used after Filter6.Query.

Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter6.Query.

func (*Filter6[A, B, C, D, E, F]) Optional

func (q *Filter6[A, B, C, D, E, F]) Optional(mask ...Comp) *Filter6[A, B, C, D, E, F]

Optional makes some of the query's components optional.

Create the required mask items with T.

Only affects component types that were specified in the query.

func (*Filter6[A, B, C, D, E, F]) Query

func (q *Filter6[A, B, C, D, E, F]) Query(w *ecs.World) Query6[A, B, C, D, E, F]

Query builds a Query6 query for iteration.

func (*Filter6[A, B, C, D, E, F]) With

func (q *Filter6[A, B, C, D, E, F]) With(mask ...Comp) *Filter6[A, B, C, D, E, F]

With adds components that are required, but not accessible via Query6.Get.

Create the required mask items with T.

func (*Filter6[A, B, C, D, E, F]) Without

func (q *Filter6[A, B, C, D, E, F]) Without(mask ...Comp) *Filter6[A, B, C, D, E, F]

Without excludes entities with any of the given components from the query.

Create the required mask items with T.

type Filter7

type Filter7[A any, B any, C any, D any, E any, F any, G any] filter

Filter7 is a helper for building Query7 query iterators.

func NewFilter7

func NewFilter7[A any, B any, C any, D any, E any, F any, G any]() *Filter7[A, B, C, D, E, F, G]

NewFilter7 creates a generic Filter7 for seven components.

See also ecs.World.Query.

func (*Filter7[A, B, C, D, E, F, G]) Filter

func (q *Filter7[A, B, C, D, E, F, G]) Filter(w *ecs.World) ecs.MaskFilter

Filter generates and return the ecs.Filter used after Filter7.Query.

Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter7.Query.

func (*Filter7[A, B, C, D, E, F, G]) Optional

func (q *Filter7[A, B, C, D, E, F, G]) Optional(mask ...Comp) *Filter7[A, B, C, D, E, F, G]

Optional makes some of the query's components optional.

Create the required mask items with T.

Only affects component types that were specified in the query.

func (*Filter7[A, B, C, D, E, F, G]) Query

func (q *Filter7[A, B, C, D, E, F, G]) Query(w *ecs.World) Query7[A, B, C, D, E, F, G]

Query builds a Query7 query for iteration.

func (*Filter7[A, B, C, D, E, F, G]) With

func (q *Filter7[A, B, C, D, E, F, G]) With(mask ...Comp) *Filter7[A, B, C, D, E, F, G]

With adds components that are required, but not accessible via Query7.Get.

Create the required mask items with T.

func (*Filter7[A, B, C, D, E, F, G]) Without

func (q *Filter7[A, B, C, D, E, F, G]) Without(mask ...Comp) *Filter7[A, B, C, D, E, F, G]

Without excludes entities with any of the given components from the query.

Create the required mask items with T.

type Filter8

type Filter8[A any, B any, C any, D any, E any, F any, G any, H any] filter

Filter8 is a helper for building Query8 query iterators.

func NewFilter8

func NewFilter8[A any, B any, C any, D any, E any, F any, G any, H any]() *Filter8[A, B, C, D, E, F, G, H]

NewFilter8 creates a generic Filter8 for eight components.

See also ecs.World.Query.

func (*Filter8[A, B, C, D, E, F, G, H]) Filter

func (q *Filter8[A, B, C, D, E, F, G, H]) Filter(w *ecs.World) ecs.MaskFilter

Filter generates and return the ecs.Filter used after Filter8.Query.

Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter8.Query.

func (*Filter8[A, B, C, D, E, F, G, H]) Optional

func (q *Filter8[A, B, C, D, E, F, G, H]) Optional(mask ...Comp) *Filter8[A, B, C, D, E, F, G, H]

Optional makes some of the query's components optional.

Create the required mask items with T.

Only affects component types that were specified in the query.

func (*Filter8[A, B, C, D, E, F, G, H]) Query

func (q *Filter8[A, B, C, D, E, F, G, H]) Query(w *ecs.World) Query8[A, B, C, D, E, F, G, H]

Query builds a Query8 query for iteration.

func (*Filter8[A, B, C, D, E, F, G, H]) With

func (q *Filter8[A, B, C, D, E, F, G, H]) With(mask ...Comp) *Filter8[A, B, C, D, E, F, G, H]

With adds components that are required, but not accessible via Query8.Get.

Create the required mask items with T.

func (*Filter8[A, B, C, D, E, F, G, H]) Without

func (q *Filter8[A, B, C, D, E, F, G, H]) Without(mask ...Comp) *Filter8[A, B, C, D, E, F, G, H]

Without excludes entities with any of the given components from the query.

Create the required mask items with T.

type Map

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

Map provides a type-safe way to access a component type by entity ID.

Create one with NewMap.

func NewMap

func NewMap[T any](w *ecs.World) Map[T]

NewMap creates a new Map for a component type.

Map provides a type-safe way to access a component type by entity ID.

See also ecs.World.Get, ecs.World.Has and ecs.World.Set.

func (*Map[T]) Get

func (g *Map[T]) Get(entity ecs.Entity) *T

Get gets the component for the given entity.

See also ecs.World.Get.

func (*Map[T]) Has

func (g *Map[T]) Has(entity ecs.Entity) bool

Has returns whether the entity has the component.

See also ecs.World.Has.

func (*Map[T]) ID

func (g *Map[T]) ID() ecs.ID

ID returns the component ID for this Map.

func (*Map[T]) Set

func (g *Map[T]) Set(entity ecs.Entity, comp *T) *T

Set overwrites the component for the given entity.

Panics if the entity does not have a component of that type.

See also ecs.World.Set.

type Map1

type Map1[A any] struct {
	// contains filtered or unexported fields
}

Map1 is a helper for mapping one components.

func NewMap1

func NewMap1[A any](w *ecs.World) Map1[A]

NewMap1 creates a new Map1 object.

func (*Map1[A]) Add

func (m *Map1[A]) Add(entity ecs.Entity) *A

Add the Map1's components to the given entity.

See also ecs.World.Add.

func (*Map1[A]) Assign

func (m *Map1[A]) Assign(entity ecs.Entity, a *A) *A

Assign the Map1's components to the given entity, using the supplied values.

See also ecs.World.Assign.

func (*Map1[A]) Get

func (m *Map1[A]) Get(entity ecs.Entity) *A

Get all the Map1's components for the given entity.

See also ecs.World.Get.

func (*Map1[A]) NewEntity

func (m *Map1[A]) NewEntity() (ecs.Entity, *A)

NewEntity creates a new ecs.Entity with the Map1's components.

See also ecs.World.NewEntity.

func (*Map1[A]) NewEntityWith

func (m *Map1[A]) NewEntityWith(a *A) (ecs.Entity, *A)

NewEntityWith creates a new ecs.Entity with the Map1's components, using the supplied values.

See also ecs.World.NewEntityWith.

func (*Map1[A]) Remove

func (m *Map1[A]) Remove(entity ecs.Entity)

Remove the components set via [Map1.WithRemove] from the given entity.

See also ecs.World.Remove.

type Map2

type Map2[A any, B any] struct {
	// contains filtered or unexported fields
}

Map2 is a helper for mapping two components.

func NewMap2

func NewMap2[A any, B any](w *ecs.World) Map2[A, B]

NewMap2 creates a new Map2 object.

func (*Map2[A, B]) Add

func (m *Map2[A, B]) Add(entity ecs.Entity) (*A, *B)

Add the Map2's components to the given entity.

See also ecs.World.Add.

func (*Map2[A, B]) Assign

func (m *Map2[A, B]) Assign(entity ecs.Entity, a *A, b *B) (*A, *B)

Assign the Map2's components to the given entity, using the supplied values.

See also ecs.World.Assign.

func (*Map2[A, B]) Get

func (m *Map2[A, B]) Get(entity ecs.Entity) (*A, *B)

Get all the Map2's components for the given entity.

See also ecs.World.Get.

func (*Map2[A, B]) NewEntity

func (m *Map2[A, B]) NewEntity() (ecs.Entity, *A, *B)

NewEntity creates a new ecs.Entity with the Map2's components.

See also ecs.World.NewEntity.

func (*Map2[A, B]) NewEntityWith

func (m *Map2[A, B]) NewEntityWith(a *A, b *B) (ecs.Entity, *A, *B)

NewEntityWith creates a new ecs.Entity with the Map2's components, using the supplied values.

See also ecs.World.NewEntityWith.

func (*Map2[A, B]) Remove

func (m *Map2[A, B]) Remove(entity ecs.Entity)

Remove the components set via [Map2.WithRemove] from the given entity.

See also ecs.World.Remove.

type Map3

type Map3[A any, B any, C any] struct {
	// contains filtered or unexported fields
}

Map3 is a helper for mapping three components.

func NewMap3

func NewMap3[A any, B any, C any](w *ecs.World) Map3[A, B, C]

NewMap3 creates a new Map3 object.

func (*Map3[A, B, C]) Add

func (m *Map3[A, B, C]) Add(entity ecs.Entity) (*A, *B, *C)

Add the Map3's components to the given entity.

See also ecs.World.Add.

func (*Map3[A, B, C]) Assign

func (m *Map3[A, B, C]) Assign(entity ecs.Entity, a *A, b *B, c *C) (*A, *B, *C)

Assign the Map3's components to the given entity, using the supplied values.

See also ecs.World.Assign.

func (*Map3[A, B, C]) Get

func (m *Map3[A, B, C]) Get(entity ecs.Entity) (*A, *B, *C)

Get all the Map3's components for the given entity.

See also ecs.World.Get.

func (*Map3[A, B, C]) NewEntity

func (m *Map3[A, B, C]) NewEntity() (ecs.Entity, *A, *B, *C)

NewEntity creates a new ecs.Entity with the Map3's components.

See also ecs.World.NewEntity.

func (*Map3[A, B, C]) NewEntityWith

func (m *Map3[A, B, C]) NewEntityWith(a *A, b *B, c *C) (ecs.Entity, *A, *B, *C)

NewEntityWith creates a new ecs.Entity with the Map3's components, using the supplied values.

See also ecs.World.NewEntityWith.

func (*Map3[A, B, C]) Remove

func (m *Map3[A, B, C]) Remove(entity ecs.Entity)

Remove the components set via [Map3.WithRemove] from the given entity.

See also ecs.World.Remove.

type Map4

type Map4[A any, B any, C any, D any] struct {
	// contains filtered or unexported fields
}

Map4 is a helper for mapping four components.

func NewMap4

func NewMap4[A any, B any, C any, D any](w *ecs.World) Map4[A, B, C, D]

NewMap4 creates a new Map4 object.

func (*Map4[A, B, C, D]) Add

func (m *Map4[A, B, C, D]) Add(entity ecs.Entity) (*A, *B, *C, *D)

Add the Map4's components to the given entity.

See also ecs.World.Add.

func (*Map4[A, B, C, D]) Assign

func (m *Map4[A, B, C, D]) Assign(entity ecs.Entity, a *A, b *B, c *C, d *D) (*A, *B, *C, *D)

Assign the Map4's components to the given entity, using the supplied values.

See also ecs.World.Assign.

func (*Map4[A, B, C, D]) Get

func (m *Map4[A, B, C, D]) Get(entity ecs.Entity) (*A, *B, *C, *D)

Get all the Map4's components for the given entity.

See also ecs.World.Get.

func (*Map4[A, B, C, D]) NewEntity

func (m *Map4[A, B, C, D]) NewEntity() (ecs.Entity, *A, *B, *C, *D)

NewEntity creates a new ecs.Entity with the Map4's components.

See also ecs.World.NewEntity.

func (*Map4[A, B, C, D]) NewEntityWith

func (m *Map4[A, B, C, D]) NewEntityWith(a *A, b *B, c *C, d *D) (ecs.Entity, *A, *B, *C, *D)

NewEntityWith creates a new ecs.Entity with the Map4's components, using the supplied values.

See also ecs.World.NewEntityWith.

func (*Map4[A, B, C, D]) Remove

func (m *Map4[A, B, C, D]) Remove(entity ecs.Entity)

Remove the components set via [Map4.WithRemove] from the given entity.

See also ecs.World.Remove.

type Map5

type Map5[A any, B any, C any, D any, E any] struct {
	// contains filtered or unexported fields
}

Map5 is a helper for mapping five components.

func NewMap5

func NewMap5[A any, B any, C any, D any, E any](w *ecs.World) Map5[A, B, C, D, E]

NewMap5 creates a new Map5 object.

func (*Map5[A, B, C, D, E]) Add

func (m *Map5[A, B, C, D, E]) Add(entity ecs.Entity) (*A, *B, *C, *D, *E)

Add the Map5's components to the given entity.

See also ecs.World.Add.

func (*Map5[A, B, C, D, E]) Assign

func (m *Map5[A, B, C, D, E]) Assign(entity ecs.Entity, a *A, b *B, c *C, d *D, e *E) (*A, *B, *C, *D, *E)

Assign the Map5's components to the given entity, using the supplied values.

See also ecs.World.Assign.

func (*Map5[A, B, C, D, E]) Get

func (m *Map5[A, B, C, D, E]) Get(entity ecs.Entity) (*A, *B, *C, *D, *E)

Get all the Map5's components for the given entity.

See also ecs.World.Get.

func (*Map5[A, B, C, D, E]) NewEntity

func (m *Map5[A, B, C, D, E]) NewEntity() (ecs.Entity, *A, *B, *C, *D, *E)

NewEntity creates a new ecs.Entity with the Map5's components.

See also ecs.World.NewEntity.

func (*Map5[A, B, C, D, E]) NewEntityWith

func (m *Map5[A, B, C, D, E]) NewEntityWith(a *A, b *B, c *C, d *D, e *E) (ecs.Entity, *A, *B, *C, *D, *E)

NewEntityWith creates a new ecs.Entity with the Map5's components, using the supplied values.

See also ecs.World.NewEntityWith.

func (*Map5[A, B, C, D, E]) Remove

func (m *Map5[A, B, C, D, E]) Remove(entity ecs.Entity)

Remove the components set via [Map5.WithRemove] from the given entity.

See also ecs.World.Remove.

type Map6

type Map6[A any, B any, C any, D any, E any, F any] struct {
	// contains filtered or unexported fields
}

Map6 is a helper for mapping six components.

func NewMap6

func NewMap6[A any, B any, C any, D any, E any, F any](w *ecs.World) Map6[A, B, C, D, E, F]

NewMap6 creates a new Map6 object.

func (*Map6[A, B, C, D, E, F]) Add

func (m *Map6[A, B, C, D, E, F]) Add(entity ecs.Entity) (*A, *B, *C, *D, *E, *F)

Add the Map6's components to the given entity.

See also ecs.World.Add.

func (*Map6[A, B, C, D, E, F]) Assign

func (m *Map6[A, B, C, D, E, F]) Assign(entity ecs.Entity, a *A, b *B, c *C, d *D, e *E, f *F) (*A, *B, *C, *D, *E, *F)

Assign the Map6's components to the given entity, using the supplied values.

See also ecs.World.Assign.

func (*Map6[A, B, C, D, E, F]) Get

func (m *Map6[A, B, C, D, E, F]) Get(entity ecs.Entity) (*A, *B, *C, *D, *E, *F)

Get all the Map6's components for the given entity.

See also ecs.World.Get.

func (*Map6[A, B, C, D, E, F]) NewEntity

func (m *Map6[A, B, C, D, E, F]) NewEntity() (ecs.Entity, *A, *B, *C, *D, *E, *F)

NewEntity creates a new ecs.Entity with the Map6's components.

See also ecs.World.NewEntity.

func (*Map6[A, B, C, D, E, F]) NewEntityWith

func (m *Map6[A, B, C, D, E, F]) NewEntityWith(a *A, b *B, c *C, d *D, e *E, f *F) (ecs.Entity, *A, *B, *C, *D, *E, *F)

NewEntityWith creates a new ecs.Entity with the Map6's components, using the supplied values.

See also ecs.World.NewEntityWith.

func (*Map6[A, B, C, D, E, F]) Remove

func (m *Map6[A, B, C, D, E, F]) Remove(entity ecs.Entity)

Remove the components set via [Map6.WithRemove] from the given entity.

See also ecs.World.Remove.

type Map7

type Map7[A any, B any, C any, D any, E any, F any, G any] struct {
	// contains filtered or unexported fields
}

Map7 is a helper for mapping seven components.

func NewMap7

func NewMap7[A any, B any, C any, D any, E any, F any, G any](w *ecs.World) Map7[A, B, C, D, E, F, G]

NewMap7 creates a new Map7 object.

func (*Map7[A, B, C, D, E, F, G]) Add

func (m *Map7[A, B, C, D, E, F, G]) Add(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G)

Add the Map7's components to the given entity.

See also ecs.World.Add.

func (*Map7[A, B, C, D, E, F, G]) Assign

func (m *Map7[A, B, C, D, E, F, G]) Assign(entity ecs.Entity, a *A, b *B, c *C, d *D, e *E, f *F, g *G) (*A, *B, *C, *D, *E, *F, *G)

Assign the Map7's components to the given entity, using the supplied values.

See also ecs.World.Assign.

func (*Map7[A, B, C, D, E, F, G]) Get

func (m *Map7[A, B, C, D, E, F, G]) Get(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G)

Get all the Map7's components for the given entity.

See also ecs.World.Get.

func (*Map7[A, B, C, D, E, F, G]) NewEntity

func (m *Map7[A, B, C, D, E, F, G]) NewEntity() (ecs.Entity, *A, *B, *C, *D, *E, *F, *G)

NewEntity creates a new ecs.Entity with the Map7's components.

See also ecs.World.NewEntity.

func (*Map7[A, B, C, D, E, F, G]) NewEntityWith

func (m *Map7[A, B, C, D, E, F, G]) NewEntityWith(a *A, b *B, c *C, d *D, e *E, f *F, g *G) (ecs.Entity, *A, *B, *C, *D, *E, *F, *G)

NewEntityWith creates a new ecs.Entity with the Map7's components, using the supplied values.

See also ecs.World.NewEntityWith.

func (*Map7[A, B, C, D, E, F, G]) Remove

func (m *Map7[A, B, C, D, E, F, G]) Remove(entity ecs.Entity)

Remove the components set via [Map7.WithRemove] from the given entity.

See also ecs.World.Remove.

type Map8

type Map8[A any, B any, C any, D any, E any, F any, G any, H any] struct {
	// contains filtered or unexported fields
}

Map8 is a helper for mapping eight components.

func NewMap8

func NewMap8[A any, B any, C any, D any, E any, F any, G any, H any](w *ecs.World) Map8[A, B, C, D, E, F, G, H]

NewMap8 creates a new Map8 object.

func (*Map8[A, B, C, D, E, F, G, H]) Add

func (m *Map8[A, B, C, D, E, F, G, H]) Add(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G, *H)

Add the Map8's components to the given entity.

See also ecs.World.Add.

func (*Map8[A, B, C, D, E, F, G, H]) Assign

func (m *Map8[A, B, C, D, E, F, G, H]) Assign(entity ecs.Entity, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H) (*A, *B, *C, *D, *E, *F, *G, *H)

Assign the Map8's components to the given entity, using the supplied values.

See also ecs.World.Assign.

func (*Map8[A, B, C, D, E, F, G, H]) Get

func (m *Map8[A, B, C, D, E, F, G, H]) Get(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G, *H)

Get all the Map8's components for the given entity.

See also ecs.World.Get.

func (*Map8[A, B, C, D, E, F, G, H]) NewEntity

func (m *Map8[A, B, C, D, E, F, G, H]) NewEntity() (ecs.Entity, *A, *B, *C, *D, *E, *F, *G, *H)

NewEntity creates a new ecs.Entity with the Map8's components.

See also ecs.World.NewEntity.

func (*Map8[A, B, C, D, E, F, G, H]) NewEntityWith

func (m *Map8[A, B, C, D, E, F, G, H]) NewEntityWith(a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H) (ecs.Entity, *A, *B, *C, *D, *E, *F, *G, *H)

NewEntityWith creates a new ecs.Entity with the Map8's components, using the supplied values.

See also ecs.World.NewEntityWith.

func (*Map8[A, B, C, D, E, F, G, H]) Remove

func (m *Map8[A, B, C, D, E, F, G, H]) Remove(entity ecs.Entity)

Remove the components set via [Map8.WithRemove] from the given entity.

See also ecs.World.Remove.

type Query0

type Query0 struct {
	ecs.Query
	// contains filtered or unexported fields
}

Query0 is a generic query iterator for zero components.

Create it with NewFilter0 and Filter0.Query.

Also has all methods of ecs.Query.

type Query1

type Query1[A any] struct {
	ecs.Query
	// contains filtered or unexported fields
}

Query1 is a generic query iterator for one components.

Create it with NewFilter1 and Filter1.Query.

Also has all methods of ecs.Query.

func (*Query1[A]) Get

func (q *Query1[A]) Get() *A

Get returns all queried components for the current query iterator position.

Use ecs.Query.Entity to get the current Entity.

type Query2

type Query2[A any, B any] struct {
	ecs.Query
	// contains filtered or unexported fields
}

Query2 is a generic query iterator for two components.

Create it with NewFilter2 and Filter2.Query.

Also has all methods of ecs.Query.

func (*Query2[A, B]) Get

func (q *Query2[A, B]) Get() (*A, *B)

Get returns all queried components for the current query iterator position.

Use ecs.Query.Entity to get the current Entity.

type Query3

type Query3[A any, B any, C any] struct {
	ecs.Query
	// contains filtered or unexported fields
}

Query3 is a generic query iterator for three components.

Create it with NewFilter3 and Filter3.Query.

Also has all methods of ecs.Query.

func (*Query3[A, B, C]) Get

func (q *Query3[A, B, C]) Get() (*A, *B, *C)

Get returns all queried components for the current query iterator position.

Use ecs.Query.Entity to get the current Entity.

type Query4

type Query4[A any, B any, C any, D any] struct {
	ecs.Query
	// contains filtered or unexported fields
}

Query4 is a generic query iterator for four components.

Create it with NewFilter4 and Filter4.Query.

Also has all methods of ecs.Query.

func (*Query4[A, B, C, D]) Get

func (q *Query4[A, B, C, D]) Get() (*A, *B, *C, *D)

Get returns all queried components for the current query iterator position.

Use ecs.Query.Entity to get the current Entity.

type Query5

type Query5[A any, B any, C any, D any, E any] struct {
	ecs.Query
	// contains filtered or unexported fields
}

Query5 is a generic query iterator for five components.

Create it with NewFilter5 and Filter5.Query.

Also has all methods of ecs.Query.

func (*Query5[A, B, C, D, E]) Get

func (q *Query5[A, B, C, D, E]) Get() (*A, *B, *C, *D, *E)

Get returns all queried components for the current query iterator position.

Use ecs.Query.Entity to get the current Entity.

type Query6

type Query6[A any, B any, C any, D any, E any, F any] struct {
	ecs.Query
	// contains filtered or unexported fields
}

Query6 is a generic query iterator for six components.

Create it with NewFilter6 and Filter6.Query.

Also has all methods of ecs.Query.

func (*Query6[A, B, C, D, E, F]) Get

func (q *Query6[A, B, C, D, E, F]) Get() (*A, *B, *C, *D, *E, *F)

Get returns all queried components for the current query iterator position.

Use ecs.Query.Entity to get the current Entity.

type Query7

type Query7[A any, B any, C any, D any, E any, F any, G any] struct {
	ecs.Query
	// contains filtered or unexported fields
}

Query7 is a generic query iterator for seven components.

Create it with NewFilter7 and Filter7.Query.

Also has all methods of ecs.Query.

func (*Query7[A, B, C, D, E, F, G]) Get

func (q *Query7[A, B, C, D, E, F, G]) Get() (*A, *B, *C, *D, *E, *F, *G)

Get returns all queried components for the current query iterator position.

Use ecs.Query.Entity to get the current Entity.

type Query8

type Query8[A any, B any, C any, D any, E any, F any, G any, H any] struct {
	ecs.Query
	// contains filtered or unexported fields
}

Query8 is a generic query iterator for eight components.

Create it with NewFilter8 and Filter8.Query.

Also has all methods of ecs.Query.

func (*Query8[A, B, C, D, E, F, G, H]) Get

func (q *Query8[A, B, C, D, E, F, G, H]) Get() (*A, *B, *C, *D, *E, *F, *G, *H)

Get returns all queried components for the current query iterator position.

Use ecs.Query.Entity to get the current Entity.

Directories

Path Synopsis
Package generate is for generating the boilerplate code required for the generic API.
Package generate is for generating the boilerplate code required for the generic API.

Jump to

Keyboard shortcuts

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