generic

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 3 Imported by: 28

Documentation

Overview

Package generic contains Arche's generic API.

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

🕮 Also read Arche's User Guide!

Outline

ECS Manipulations

This section gives an overview on how to achieve typical ECS manipulation operations using Arche's generic API. MapX and QueryX variants are shown as Map2 and Query2 here.

Manipulations of a single entity, with or without a relation target:

Batch-manipulations of many entities, with or without a relation target:

Index

Examples

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 T10 added in v0.10.0

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

T10 creates a component type list for ten component types.

func T11 added in v0.10.0

func T11[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any, K any]() []Comp

T11 creates a component type list for eleven component types.

func T12 added in v0.10.0

func T12[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any, K any, L any]() []Comp

T12 creates a component type list for twelve 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.

func T9 added in v0.10.0

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

T9 creates a component type list for nine 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, target ...ecs.Entity)

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

The optional argument can be used to set the target ecs.Entity for the Exchange's ecs.Relation. See Exchange.WithRelation.

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, target ...ecs.Entity)

Exchange components on an entity.

Removes the components set via Exchange.Removes. Adds the components set via Exchange.Adds. The optional argument can be used to set the target ecs.Entity for the Exchange's ecs.Relation. See Exchange.WithRelation. When a ecs.Relation component is removed and another one is added, the target entity of the relation is set to zero if no target is given.

See also ecs.World.Exchange.

func (*Exchange) ExchangeBatch added in v0.10.0

func (m *Exchange) ExchangeBatch(filter ecs.Filter, target ...ecs.Entity) int

ExchangeBatch exchanges components on many entities, matching a filter. Returns the number of affected entities.

Removes the components set via Exchange.Removes. Adds the components set via Exchange.Adds. The optional argument can be used to set the target ecs.Entity for the Exchange's ecs.Relation. See Exchange.WithRelation. When a ecs.Relation component is removed and another one is added, the target entity of the relation is set to zero if no target is given.

See also ecs.Batch.Exchange and ecs.Batch.ExchangeQ.

func (*Exchange) NewEntity

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

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

The optional argument can be used to set the target ecs.Entity for the Exchange's ecs.Relation. See Exchange.WithRelation.

See also ecs.World.NewEntity.

func (*Exchange) Remove

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

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

The optional argument can be used to set the target ecs.Entity for the Exchange's ecs.Relation. See Exchange.WithRelation.

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.

func (*Exchange) WithRelation added in v0.10.0

func (m *Exchange) WithRelation(comp Comp) *Exchange

WithRelation sets the [Relation] component for the Exchange.

Use in conjunction with the optional target argument of Exchange.NewEntity, Exchange.Add, Exchange.Remove and Exchange.Exchange.

See [Relation] for details and examples.

type Filter0

type Filter0 filter

Filter0 is a helper for building Query0 query iterators.

Example

world := ecs.NewWorld()

filter := NewFilter0()
query := filter.Query(&world)

complexFilter :=
	NewFilter0().
		With(T2[V, W]()...).
		Without(T3[X, Y, Z]()...).

func NewFilter0

func NewFilter0() *Filter0

NewFilter0 creates a generic Filter0 for zero components.

See also ecs.World.Query.

func (*Filter0) Exclusive added in v0.11.0

func (f *Filter0) Exclusive() *Filter0

Exclusive makes the filter exclusive in the sense that the component composition is matched exactly, and no other components are allowed.

func (*Filter0) Filter

func (f *Filter0) Filter(w *ecs.World, target ...ecs.Entity) ecs.Filter

Filter builds an ecs.Filter, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter0) Query

func (f *Filter0) Query(w *ecs.World, target ...ecs.Entity) Query0

Query builds a Query0 query for iteration, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter0) Register added in v0.6.0

func (f *Filter0) Register(w *ecs.World)

Register the filter for caching.

See ecs.Cache for details on filter caching.

func (*Filter0) Unregister added in v0.6.0

func (f *Filter0) Unregister(w *ecs.World)

Unregister the filter from caching.

See ecs.Cache for details on filter caching.

func (*Filter0) With

func (f *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) WithRelation added in v0.8.0

func (f *Filter0) WithRelation(comp Comp, target ...ecs.Entity) *Filter0

WithRelation sets the filter's ecs.Relation component and optionally restricts the query to entities that have the given relation target.

Use without the optional argument to specify the relation target in Filter0.Query. If the optional argument is provided, the filter's relation target is set permanently.

Create the required component ID with T.

func (*Filter0) Without

func (f *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.

Example

world := ecs.NewWorld()

filter := NewFilter1[A]()
query := filter.Query(&world)

complexFilter :=
	NewFilter1[A]().
		Optional(T[A]()).
		With(T2[V, W]()...).
		Without(T3[X, Y, Z]()...).

func NewFilter1

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

NewFilter1 creates a generic Filter1 for one components.

See also ecs.World.Query.

func (*Filter1[A]) Exclusive added in v0.11.0

func (f *Filter1[A]) Exclusive() *Filter1[A]

Exclusive makes the filter exclusive in the sense that the component composition is matched exactly, and no other components are allowed.

func (*Filter1[A]) Filter

func (f *Filter1[A]) Filter(w *ecs.World, target ...ecs.Entity) ecs.Filter

Filter builds an ecs.Filter, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter1[A]) Optional

func (f *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 (f *Filter1[A]) Query(w *ecs.World, target ...ecs.Entity) Query1[A]

Query builds a Query1 query for iteration, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter1[A]) Register added in v0.6.0

func (f *Filter1[A]) Register(w *ecs.World)

Register the filter for caching.

See ecs.Cache for details on filter caching.

func (*Filter1[A]) Unregister added in v0.6.0

func (f *Filter1[A]) Unregister(w *ecs.World)

Unregister the filter from caching.

See ecs.Cache for details on filter caching.

func (*Filter1[A]) With

func (f *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]) WithRelation added in v0.8.0

func (f *Filter1[A]) WithRelation(comp Comp, target ...ecs.Entity) *Filter1[A]

WithRelation sets the filter's ecs.Relation component and optionally restricts the query to entities that have the given relation target.

Use without the optional argument to specify the relation target in Filter1.Query. If the optional argument is provided, the filter's relation target is set permanently.

Create the required component ID with T.

func (*Filter1[A]) Without

func (f *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 Filter10 added in v0.10.0

type Filter10[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any] filter

Filter10 is a helper for building Query10 query iterators.

Example

world := ecs.NewWorld()

filter := NewFilter10[A, B, C, D, E, F, G, H, I, J]()
query := filter.Query(&world)

complexFilter :=
	NewFilter10[A, B, C, D, E, F, G, H, I, J]().
		Optional(T[A]()).
		With(T2[V, W]()...).
		Without(T3[X, Y, Z]()...).

func NewFilter10 added in v0.10.0

func NewFilter10[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any]() *Filter10[A, B, C, D, E, F, G, H, I, J]

NewFilter10 creates a generic Filter10 for ten components.

See also ecs.World.Query.

func (*Filter10[A, B, C, D, E, F, G, H, I, J]) Exclusive added in v0.11.0

func (f *Filter10[A, B, C, D, E, F, G, H, I, J]) Exclusive() *Filter10[A, B, C, D, E, F, G, H, I, J]

Exclusive makes the filter exclusive in the sense that the component composition is matched exactly, and no other components are allowed.

func (*Filter10[A, B, C, D, E, F, G, H, I, J]) Filter added in v0.10.0

func (f *Filter10[A, B, C, D, E, F, G, H, I, J]) Filter(w *ecs.World, target ...ecs.Entity) ecs.Filter

Filter builds an ecs.Filter, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter10[A, B, C, D, E, F, G, H, I, J]) Optional added in v0.10.0

func (f *Filter10[A, B, C, D, E, F, G, H, I, J]) Optional(mask ...Comp) *Filter10[A, B, C, D, E, F, G, H, I, J]

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 (*Filter10[A, B, C, D, E, F, G, H, I, J]) Query added in v0.10.0

func (f *Filter10[A, B, C, D, E, F, G, H, I, J]) Query(w *ecs.World, target ...ecs.Entity) Query10[A, B, C, D, E, F, G, H, I, J]

Query builds a Query10 query for iteration, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter10[A, B, C, D, E, F, G, H, I, J]) Register added in v0.10.0

func (f *Filter10[A, B, C, D, E, F, G, H, I, J]) Register(w *ecs.World)

Register the filter for caching.

See ecs.Cache for details on filter caching.

func (*Filter10[A, B, C, D, E, F, G, H, I, J]) Unregister added in v0.10.0

func (f *Filter10[A, B, C, D, E, F, G, H, I, J]) Unregister(w *ecs.World)

Unregister the filter from caching.

See ecs.Cache for details on filter caching.

func (*Filter10[A, B, C, D, E, F, G, H, I, J]) With added in v0.10.0

func (f *Filter10[A, B, C, D, E, F, G, H, I, J]) With(mask ...Comp) *Filter10[A, B, C, D, E, F, G, H, I, J]

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

Create the required mask items with T.

func (*Filter10[A, B, C, D, E, F, G, H, I, J]) WithRelation added in v0.10.0

func (f *Filter10[A, B, C, D, E, F, G, H, I, J]) WithRelation(comp Comp, target ...ecs.Entity) *Filter10[A, B, C, D, E, F, G, H, I, J]

WithRelation sets the filter's ecs.Relation component and optionally restricts the query to entities that have the given relation target.

Use without the optional argument to specify the relation target in Filter10.Query. If the optional argument is provided, the filter's relation target is set permanently.

Create the required component ID with T.

func (*Filter10[A, B, C, D, E, F, G, H, I, J]) Without added in v0.10.0

func (f *Filter10[A, B, C, D, E, F, G, H, I, J]) Without(mask ...Comp) *Filter10[A, B, C, D, E, F, G, H, I, J]

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

Create the required mask items with T.

type Filter11 added in v0.10.0

type Filter11[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any, K any] filter

Filter11 is a helper for building Query11 query iterators.

Example

world := ecs.NewWorld()

filter := NewFilter11[A, B, C, D, E, F, G, H, I, J, K]()
query := filter.Query(&world)

complexFilter :=
	NewFilter11[A, B, C, D, E, F, G, H, I, J, K]().
		Optional(T[A]()).
		With(T2[V, W]()...).
		Without(T3[X, Y, Z]()...).

func NewFilter11 added in v0.10.0

func NewFilter11[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any, K any]() *Filter11[A, B, C, D, E, F, G, H, I, J, K]

NewFilter11 creates a generic Filter11 for eleven components.

See also ecs.World.Query.

func (*Filter11[A, B, C, D, E, F, G, H, I, J, K]) Exclusive added in v0.11.0

func (f *Filter11[A, B, C, D, E, F, G, H, I, J, K]) Exclusive() *Filter11[A, B, C, D, E, F, G, H, I, J, K]

Exclusive makes the filter exclusive in the sense that the component composition is matched exactly, and no other components are allowed.

func (*Filter11[A, B, C, D, E, F, G, H, I, J, K]) Filter added in v0.10.0

func (f *Filter11[A, B, C, D, E, F, G, H, I, J, K]) Filter(w *ecs.World, target ...ecs.Entity) ecs.Filter

Filter builds an ecs.Filter, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter11[A, B, C, D, E, F, G, H, I, J, K]) Optional added in v0.10.0

func (f *Filter11[A, B, C, D, E, F, G, H, I, J, K]) Optional(mask ...Comp) *Filter11[A, B, C, D, E, F, G, H, I, J, K]

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 (*Filter11[A, B, C, D, E, F, G, H, I, J, K]) Query added in v0.10.0

func (f *Filter11[A, B, C, D, E, F, G, H, I, J, K]) Query(w *ecs.World, target ...ecs.Entity) Query11[A, B, C, D, E, F, G, H, I, J, K]

Query builds a Query11 query for iteration, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter11[A, B, C, D, E, F, G, H, I, J, K]) Register added in v0.10.0

func (f *Filter11[A, B, C, D, E, F, G, H, I, J, K]) Register(w *ecs.World)

Register the filter for caching.

See ecs.Cache for details on filter caching.

func (*Filter11[A, B, C, D, E, F, G, H, I, J, K]) Unregister added in v0.10.0

func (f *Filter11[A, B, C, D, E, F, G, H, I, J, K]) Unregister(w *ecs.World)

Unregister the filter from caching.

See ecs.Cache for details on filter caching.

func (*Filter11[A, B, C, D, E, F, G, H, I, J, K]) With added in v0.10.0

func (f *Filter11[A, B, C, D, E, F, G, H, I, J, K]) With(mask ...Comp) *Filter11[A, B, C, D, E, F, G, H, I, J, K]

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

Create the required mask items with T.

func (*Filter11[A, B, C, D, E, F, G, H, I, J, K]) WithRelation added in v0.10.0

func (f *Filter11[A, B, C, D, E, F, G, H, I, J, K]) WithRelation(comp Comp, target ...ecs.Entity) *Filter11[A, B, C, D, E, F, G, H, I, J, K]

WithRelation sets the filter's ecs.Relation component and optionally restricts the query to entities that have the given relation target.

Use without the optional argument to specify the relation target in Filter11.Query. If the optional argument is provided, the filter's relation target is set permanently.

Create the required component ID with T.

func (*Filter11[A, B, C, D, E, F, G, H, I, J, K]) Without added in v0.10.0

func (f *Filter11[A, B, C, D, E, F, G, H, I, J, K]) Without(mask ...Comp) *Filter11[A, B, C, D, E, F, G, H, I, J, K]

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

Create the required mask items with T.

type Filter12 added in v0.10.0

type Filter12[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any, K any, L any] filter

Filter12 is a helper for building Query12 query iterators.

Example

world := ecs.NewWorld()

filter := NewFilter12[A, B, C, D, E, F, G, H, I, J, K, L]()
query := filter.Query(&world)

complexFilter :=
	NewFilter12[A, B, C, D, E, F, G, H, I, J, K, L]().
		Optional(T[A]()).
		With(T2[V, W]()...).
		Without(T3[X, Y, Z]()...).

func NewFilter12 added in v0.10.0

func NewFilter12[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any, K any, L any]() *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]

NewFilter12 creates a generic Filter12 for twelve components.

See also ecs.World.Query.

func (*Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) Exclusive added in v0.11.0

func (f *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) Exclusive() *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]

Exclusive makes the filter exclusive in the sense that the component composition is matched exactly, and no other components are allowed.

func (*Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) Filter added in v0.10.0

func (f *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) Filter(w *ecs.World, target ...ecs.Entity) ecs.Filter

Filter builds an ecs.Filter, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) Optional added in v0.10.0

func (f *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) Optional(mask ...Comp) *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]

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 (*Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) Query added in v0.10.0

func (f *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) Query(w *ecs.World, target ...ecs.Entity) Query12[A, B, C, D, E, F, G, H, I, J, K, L]

Query builds a Query12 query for iteration, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) Register added in v0.10.0

func (f *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) Register(w *ecs.World)

Register the filter for caching.

See ecs.Cache for details on filter caching.

func (*Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) Unregister added in v0.10.0

func (f *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) Unregister(w *ecs.World)

Unregister the filter from caching.

See ecs.Cache for details on filter caching.

func (*Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) With added in v0.10.0

func (f *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) With(mask ...Comp) *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]

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

Create the required mask items with T.

func (*Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) WithRelation added in v0.10.0

func (f *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) WithRelation(comp Comp, target ...ecs.Entity) *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]

WithRelation sets the filter's ecs.Relation component and optionally restricts the query to entities that have the given relation target.

Use without the optional argument to specify the relation target in Filter12.Query. If the optional argument is provided, the filter's relation target is set permanently.

Create the required component ID with T.

func (*Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) Without added in v0.10.0

func (f *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]) Without(mask ...Comp) *Filter12[A, B, C, D, E, F, G, H, I, J, K, L]

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.

Example

world := ecs.NewWorld()

filter := NewFilter2[A, B]()
query := filter.Query(&world)

complexFilter :=
	NewFilter2[A, B]().
		Optional(T[A]()).
		With(T2[V, W]()...).
		Without(T3[X, Y, Z]()...).

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]) Exclusive added in v0.11.0

func (f *Filter2[A, B]) Exclusive() *Filter2[A, B]

Exclusive makes the filter exclusive in the sense that the component composition is matched exactly, and no other components are allowed.

func (*Filter2[A, B]) Filter

func (f *Filter2[A, B]) Filter(w *ecs.World, target ...ecs.Entity) ecs.Filter

Filter builds an ecs.Filter, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter2[A, B]) Optional

func (f *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 (f *Filter2[A, B]) Query(w *ecs.World, target ...ecs.Entity) Query2[A, B]

Query builds a Query2 query for iteration, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter2[A, B]) Register added in v0.6.0

func (f *Filter2[A, B]) Register(w *ecs.World)

Register the filter for caching.

See ecs.Cache for details on filter caching.

func (*Filter2[A, B]) Unregister added in v0.6.0

func (f *Filter2[A, B]) Unregister(w *ecs.World)

Unregister the filter from caching.

See ecs.Cache for details on filter caching.

func (*Filter2[A, B]) With

func (f *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]) WithRelation added in v0.8.0

func (f *Filter2[A, B]) WithRelation(comp Comp, target ...ecs.Entity) *Filter2[A, B]

WithRelation sets the filter's ecs.Relation component and optionally restricts the query to entities that have the given relation target.

Use without the optional argument to specify the relation target in Filter2.Query. If the optional argument is provided, the filter's relation target is set permanently.

Create the required component ID with T.

func (*Filter2[A, B]) Without

func (f *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.

Example

world := ecs.NewWorld()

filter := NewFilter3[A, B, C]()
query := filter.Query(&world)

complexFilter :=
	NewFilter3[A, B, C]().
		Optional(T[A]()).
		With(T2[V, W]()...).
		Without(T3[X, Y, Z]()...).

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]) Exclusive added in v0.11.0

func (f *Filter3[A, B, C]) Exclusive() *Filter3[A, B, C]

Exclusive makes the filter exclusive in the sense that the component composition is matched exactly, and no other components are allowed.

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

func (f *Filter3[A, B, C]) Filter(w *ecs.World, target ...ecs.Entity) ecs.Filter

Filter builds an ecs.Filter, with an optional relation target.

A relation target can't be used:

Panics in these cases.

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

func (f *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 (f *Filter3[A, B, C]) Query(w *ecs.World, target ...ecs.Entity) Query3[A, B, C]

Query builds a Query3 query for iteration, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter3[A, B, C]) Register added in v0.6.0

func (f *Filter3[A, B, C]) Register(w *ecs.World)

Register the filter for caching.

See ecs.Cache for details on filter caching.

func (*Filter3[A, B, C]) Unregister added in v0.6.0

func (f *Filter3[A, B, C]) Unregister(w *ecs.World)

Unregister the filter from caching.

See ecs.Cache for details on filter caching.

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

func (f *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]) WithRelation added in v0.8.0

func (f *Filter3[A, B, C]) WithRelation(comp Comp, target ...ecs.Entity) *Filter3[A, B, C]

WithRelation sets the filter's ecs.Relation component and optionally restricts the query to entities that have the given relation target.

Use without the optional argument to specify the relation target in Filter3.Query. If the optional argument is provided, the filter's relation target is set permanently.

Create the required component ID with T.

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

func (f *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.

Example

world := ecs.NewWorld()

filter := NewFilter4[A, B, C, D]()
query := filter.Query(&world)

complexFilter :=
	NewFilter4[A, B, C, D]().
		Optional(T[A]()).
		With(T2[V, W]()...).
		Without(T3[X, Y, Z]()...).

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]) Exclusive added in v0.11.0

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

Exclusive makes the filter exclusive in the sense that the component composition is matched exactly, and no other components are allowed.

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

func (f *Filter4[A, B, C, D]) Filter(w *ecs.World, target ...ecs.Entity) ecs.Filter

Filter builds an ecs.Filter, with an optional relation target.

A relation target can't be used:

Panics in these cases.

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

func (f *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 (f *Filter4[A, B, C, D]) Query(w *ecs.World, target ...ecs.Entity) Query4[A, B, C, D]

Query builds a Query4 query for iteration, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter4[A, B, C, D]) Register added in v0.6.0

func (f *Filter4[A, B, C, D]) Register(w *ecs.World)

Register the filter for caching.

See ecs.Cache for details on filter caching.

func (*Filter4[A, B, C, D]) Unregister added in v0.6.0

func (f *Filter4[A, B, C, D]) Unregister(w *ecs.World)

Unregister the filter from caching.

See ecs.Cache for details on filter caching.

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

func (f *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]) WithRelation added in v0.8.0

func (f *Filter4[A, B, C, D]) WithRelation(comp Comp, target ...ecs.Entity) *Filter4[A, B, C, D]

WithRelation sets the filter's ecs.Relation component and optionally restricts the query to entities that have the given relation target.

Use without the optional argument to specify the relation target in Filter4.Query. If the optional argument is provided, the filter's relation target is set permanently.

Create the required component ID with T.

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

func (f *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.

Example

world := ecs.NewWorld()

filter := NewFilter5[A, B, C, D, E]()
query := filter.Query(&world)

complexFilter :=
	NewFilter5[A, B, C, D, E]().
		Optional(T[A]()).
		With(T2[V, W]()...).
		Without(T3[X, Y, Z]()...).

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]) Exclusive added in v0.11.0

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

Exclusive makes the filter exclusive in the sense that the component composition is matched exactly, and no other components are allowed.

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

func (f *Filter5[A, B, C, D, E]) Filter(w *ecs.World, target ...ecs.Entity) ecs.Filter

Filter builds an ecs.Filter, with an optional relation target.

A relation target can't be used:

Panics in these cases.

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

func (f *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 (f *Filter5[A, B, C, D, E]) Query(w *ecs.World, target ...ecs.Entity) Query5[A, B, C, D, E]

Query builds a Query5 query for iteration, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter5[A, B, C, D, E]) Register added in v0.6.0

func (f *Filter5[A, B, C, D, E]) Register(w *ecs.World)

Register the filter for caching.

See ecs.Cache for details on filter caching.

func (*Filter5[A, B, C, D, E]) Unregister added in v0.6.0

func (f *Filter5[A, B, C, D, E]) Unregister(w *ecs.World)

Unregister the filter from caching.

See ecs.Cache for details on filter caching.

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

func (f *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]) WithRelation added in v0.8.0

func (f *Filter5[A, B, C, D, E]) WithRelation(comp Comp, target ...ecs.Entity) *Filter5[A, B, C, D, E]

WithRelation sets the filter's ecs.Relation component and optionally restricts the query to entities that have the given relation target.

Use without the optional argument to specify the relation target in Filter5.Query. If the optional argument is provided, the filter's relation target is set permanently.

Create the required component ID with T.

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

func (f *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.

Example

world := ecs.NewWorld()

filter := NewFilter6[A, B, C, D, E, F]()
query := filter.Query(&world)

complexFilter :=
	NewFilter6[A, B, C, D, E, F]().
		Optional(T[A]()).
		With(T2[V, W]()...).
		Without(T3[X, Y, Z]()...).

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]) Exclusive added in v0.11.0

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

Exclusive makes the filter exclusive in the sense that the component composition is matched exactly, and no other components are allowed.

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

func (f *Filter6[A, B, C, D, E, F]) Filter(w *ecs.World, target ...ecs.Entity) ecs.Filter

Filter builds an ecs.Filter, with an optional relation target.

A relation target can't be used:

Panics in these cases.

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

func (f *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 (f *Filter6[A, B, C, D, E, F]) Query(w *ecs.World, target ...ecs.Entity) Query6[A, B, C, D, E, F]

Query builds a Query6 query for iteration, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter6[A, B, C, D, E, F]) Register added in v0.6.0

func (f *Filter6[A, B, C, D, E, F]) Register(w *ecs.World)

Register the filter for caching.

See ecs.Cache for details on filter caching.

func (*Filter6[A, B, C, D, E, F]) Unregister added in v0.6.0

func (f *Filter6[A, B, C, D, E, F]) Unregister(w *ecs.World)

Unregister the filter from caching.

See ecs.Cache for details on filter caching.

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

func (f *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]) WithRelation added in v0.8.0

func (f *Filter6[A, B, C, D, E, F]) WithRelation(comp Comp, target ...ecs.Entity) *Filter6[A, B, C, D, E, F]

WithRelation sets the filter's ecs.Relation component and optionally restricts the query to entities that have the given relation target.

Use without the optional argument to specify the relation target in Filter6.Query. If the optional argument is provided, the filter's relation target is set permanently.

Create the required component ID with T.

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

func (f *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.

Example

world := ecs.NewWorld()

filter := NewFilter7[A, B, C, D, E, F, G]()
query := filter.Query(&world)

complexFilter :=
	NewFilter7[A, B, C, D, E, F, G]().
		Optional(T[A]()).
		With(T2[V, W]()...).
		Without(T3[X, Y, Z]()...).

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]) Exclusive added in v0.11.0

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

Exclusive makes the filter exclusive in the sense that the component composition is matched exactly, and no other components are allowed.

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

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

Filter builds an ecs.Filter, with an optional relation target.

A relation target can't be used:

Panics in these cases.

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

func (f *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 (f *Filter7[A, B, C, D, E, F, G]) Query(w *ecs.World, target ...ecs.Entity) Query7[A, B, C, D, E, F, G]

Query builds a Query7 query for iteration, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter7[A, B, C, D, E, F, G]) Register added in v0.6.0

func (f *Filter7[A, B, C, D, E, F, G]) Register(w *ecs.World)

Register the filter for caching.

See ecs.Cache for details on filter caching.

func (*Filter7[A, B, C, D, E, F, G]) Unregister added in v0.6.0

func (f *Filter7[A, B, C, D, E, F, G]) Unregister(w *ecs.World)

Unregister the filter from caching.

See ecs.Cache for details on filter caching.

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

func (f *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]) WithRelation added in v0.8.0

func (f *Filter7[A, B, C, D, E, F, G]) WithRelation(comp Comp, target ...ecs.Entity) *Filter7[A, B, C, D, E, F, G]

WithRelation sets the filter's ecs.Relation component and optionally restricts the query to entities that have the given relation target.

Use without the optional argument to specify the relation target in Filter7.Query. If the optional argument is provided, the filter's relation target is set permanently.

Create the required component ID with T.

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

func (f *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.

Example

world := ecs.NewWorld()

filter := NewFilter8[A, B, C, D, E, F, G, H]()
query := filter.Query(&world)

complexFilter :=
	NewFilter8[A, B, C, D, E, F, G, H]().
		Optional(T[A]()).
		With(T2[V, W]()...).
		Without(T3[X, Y, Z]()...).

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]) Exclusive added in v0.11.0

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

Exclusive makes the filter exclusive in the sense that the component composition is matched exactly, and no other components are allowed.

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

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

Filter builds an ecs.Filter, with an optional relation target.

A relation target can't be used:

Panics in these cases.

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

func (f *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 (f *Filter8[A, B, C, D, E, F, G, H]) Query(w *ecs.World, target ...ecs.Entity) Query8[A, B, C, D, E, F, G, H]

Query builds a Query8 query for iteration, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter8[A, B, C, D, E, F, G, H]) Register added in v0.6.0

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

Register the filter for caching.

See ecs.Cache for details on filter caching.

func (*Filter8[A, B, C, D, E, F, G, H]) Unregister added in v0.6.0

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

Unregister the filter from caching.

See ecs.Cache for details on filter caching.

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

func (f *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]) WithRelation added in v0.8.0

func (f *Filter8[A, B, C, D, E, F, G, H]) WithRelation(comp Comp, target ...ecs.Entity) *Filter8[A, B, C, D, E, F, G, H]

WithRelation sets the filter's ecs.Relation component and optionally restricts the query to entities that have the given relation target.

Use without the optional argument to specify the relation target in Filter8.Query. If the optional argument is provided, the filter's relation target is set permanently.

Create the required component ID with T.

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

func (f *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 Filter9 added in v0.10.0

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

Filter9 is a helper for building Query9 query iterators.

Example

world := ecs.NewWorld()

filter := NewFilter9[A, B, C, D, E, F, G, H, I]()
query := filter.Query(&world)

complexFilter :=
	NewFilter9[A, B, C, D, E, F, G, H, I]().
		Optional(T[A]()).
		With(T2[V, W]()...).
		Without(T3[X, Y, Z]()...).

func NewFilter9 added in v0.10.0

func NewFilter9[A any, B any, C any, D any, E any, F any, G any, H any, I any]() *Filter9[A, B, C, D, E, F, G, H, I]

NewFilter9 creates a generic Filter9 for nine components.

See also ecs.World.Query.

func (*Filter9[A, B, C, D, E, F, G, H, I]) Exclusive added in v0.11.0

func (f *Filter9[A, B, C, D, E, F, G, H, I]) Exclusive() *Filter9[A, B, C, D, E, F, G, H, I]

Exclusive makes the filter exclusive in the sense that the component composition is matched exactly, and no other components are allowed.

func (*Filter9[A, B, C, D, E, F, G, H, I]) Filter added in v0.10.0

func (f *Filter9[A, B, C, D, E, F, G, H, I]) Filter(w *ecs.World, target ...ecs.Entity) ecs.Filter

Filter builds an ecs.Filter, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter9[A, B, C, D, E, F, G, H, I]) Optional added in v0.10.0

func (f *Filter9[A, B, C, D, E, F, G, H, I]) Optional(mask ...Comp) *Filter9[A, B, C, D, E, F, G, H, I]

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 (*Filter9[A, B, C, D, E, F, G, H, I]) Query added in v0.10.0

func (f *Filter9[A, B, C, D, E, F, G, H, I]) Query(w *ecs.World, target ...ecs.Entity) Query9[A, B, C, D, E, F, G, H, I]

Query builds a Query9 query for iteration, with an optional relation target.

A relation target can't be used:

Panics in these cases.

func (*Filter9[A, B, C, D, E, F, G, H, I]) Register added in v0.10.0

func (f *Filter9[A, B, C, D, E, F, G, H, I]) Register(w *ecs.World)

Register the filter for caching.

See ecs.Cache for details on filter caching.

func (*Filter9[A, B, C, D, E, F, G, H, I]) Unregister added in v0.10.0

func (f *Filter9[A, B, C, D, E, F, G, H, I]) Unregister(w *ecs.World)

Unregister the filter from caching.

See ecs.Cache for details on filter caching.

func (*Filter9[A, B, C, D, E, F, G, H, I]) With added in v0.10.0

func (f *Filter9[A, B, C, D, E, F, G, H, I]) With(mask ...Comp) *Filter9[A, B, C, D, E, F, G, H, I]

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

Create the required mask items with T.

func (*Filter9[A, B, C, D, E, F, G, H, I]) WithRelation added in v0.10.0

func (f *Filter9[A, B, C, D, E, F, G, H, I]) WithRelation(comp Comp, target ...ecs.Entity) *Filter9[A, B, C, D, E, F, G, H, I]

WithRelation sets the filter's ecs.Relation component and optionally restricts the query to entities that have the given relation target.

Use without the optional argument to specify the relation target in Filter9.Query. If the optional argument is provided, the filter's relation target is set permanently.

Create the required component ID with T.

func (*Filter9[A, B, C, D, E, F, G, H, I]) Without added in v0.10.0

func (f *Filter9[A, B, C, D, E, F, G, H, I]) Without(mask ...Comp) *Filter9[A, B, C, D, E, F, G, H, I]

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.

Example
// Create a world.
world := ecs.NewWorld()

// Spawn some entities using the generic API.
spawner := NewMap2[Position, Velocity](&world)
entity := spawner.New()

// Create a new Map.
mapper := NewMap[Position](&world)

// Get the map's component.
pos := mapper.Get(entity)
pos.X, pos.Y = 10, 5

// Get the map's component, optimized for cases when the entity is guaranteed to be still alive.
pos = mapper.GetUnchecked(entity)
pos.X, pos.Y = 10, 5
Output:

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 (m *Map[T]) Get(entity ecs.Entity) *T

Get gets the component for the given entity.

See Map.HasUnchecked for an optimized version for static entities. See also ecs.World.Get.

func (*Map[T]) GetRelation added in v0.8.0

func (m *Map[T]) GetRelation(entity ecs.Entity) ecs.Entity

GetRelation returns the target entity for the given entity and the Map's relation component.

Panics:

  • if the entity does not have a component of that type.
  • if the component is not an ecs.Relation.
  • if the entity has been removed/recycled.

See also ecs.World.GetRelation.

func (*Map[T]) GetRelationUnchecked added in v0.8.0

func (m *Map[T]) GetRelationUnchecked(entity ecs.Entity) ecs.Entity

GetRelation returns the target entity for the given entity and the Map's relation component.

Returns the zero entity if the entity does not have the given component, or if the component is not an ecs.Relation.

GetRelationUnchecked is an optimized version of Map.GetRelation. Does not check if the entity is alive or that the component ID is applicable.

See also ecs.World.GetRelationUnchecked.

func (*Map[T]) GetUnchecked added in v0.7.0

func (m *Map[T]) GetUnchecked(entity ecs.Entity) *T

GetUnchecked gets the component for the given entity.

GetUnchecked is an optimized version of Map.Get, for cases where entities are static or checked with ecs.World.Alive in user code.

See also ecs.World.GetUnchecked.

func (*Map[T]) Has

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

Has returns whether the entity has the component.

See Map.HasUnchecked for an optimized version for static entities. See also ecs.World.Has.

func (*Map[T]) HasUnchecked added in v0.7.0

func (m *Map[T]) HasUnchecked(entity ecs.Entity) bool

HasUnchecked returns whether the entity has the component.

HasUnchecked is an optimized version of Map.Has, for cases where entities are static or checked with ecs.World.Alive in user code.

See also ecs.World.HasUnchecked.

func (*Map[T]) ID

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

ID returns the component ID for this Map.

func (*Map[T]) Set

func (m *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.

func (*Map[T]) SetRelation added in v0.8.0

func (m *Map[T]) SetRelation(entity, target ecs.Entity)

SetRelation sets the target entity for the given entity and the Map's component.

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

See also ecs.World.SetRelation.

func (*Map[T]) SetRelationBatch added in v0.10.0

func (m *Map[T]) SetRelationBatch(filter ecs.Filter, target ecs.Entity) int

SetRelationBatch sets the target entity for many entities and the Map's component. Returns the number of affected entities.

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

See also ecs.Batch.SetRelation.

func (*Map[T]) SetRelationBatchQ added in v0.10.0

func (m *Map[T]) SetRelationBatchQ(filter ecs.Filter, target ecs.Entity) Query1[T]

SetRelationBatch sets the target entity for many entities and the Map's component, and returns a query over them.

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

See also ecs.Batch.SetRelation.

type Map1

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

Map1 is a helper for mapping one components.

Example

world := ecs.NewWorld()

mapper := NewMap1[A](&world)

entity := mapper.NewEntity()
a := mapper.Get(entity)

func NewMap1

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

NewMap1 creates a new Map1 object.

The optional argument can be used to set an ecs.Relation component type.

func (*Map1[A]) Add

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

Add the Map1's components to the given entity.

The optional argument can be used to set the target ecs.Entity for the Map1's ecs.Relation.

See also ecs.World.Add.

func (*Map1[A]) AddBatch added in v0.10.0

func (m *Map1[A]) AddBatch(filter ecs.Filter, target ...ecs.Entity) int

AddBatch adds the Map1's components to many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map1's ecs.Relation.

See also ecs.Batch.Add.

func (*Map1[A]) AddBatchQ added in v0.10.0

func (m *Map1[A]) AddBatchQ(filter ecs.Filter, target ...ecs.Entity) Query1[A]

AddBatchQ adds the Map1's components to multiple entities and returns a query over them and the newly added Map1's components.

The optional argument can be used to set the target ecs.Entity for the Map1's ecs.Relation.

See also ecs.Batch.AddQ.

func (*Map1[A]) Assign

func (m *Map1[A]) Assign(entity ecs.Entity, 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 Map1.GetUnchecked for an optimized version for static entities. See also ecs.World.Get.

func (*Map1[A]) GetUnchecked added in v0.7.0

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

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

GetUnchecked is an optimized version of Map1.Get, for cases where entities are static or checked with ecs.World.Alive in user code.

See also ecs.World.GetUnchecked.

func (*Map1[A]) New added in v0.8.0

func (m *Map1[A]) New(target ...ecs.Entity) ecs.Entity

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

The optional argument can be used to set the target ecs.Entity for the Map1's ecs.Relation.

See also ecs.World.NewEntity.

func (*Map1[A]) NewBatch added in v0.8.0

func (m *Map1[A]) NewBatch(count int, target ...ecs.Entity)

NewBatch creates entities with the Map1's components.

The optional argument can be used to set the target ecs.Entity for the Map1's ecs.Relation.

See also Map1.NewBatchQ and ecs.Batch.NewBatch.

func (*Map1[A]) NewBatchQ added in v0.8.0

func (m *Map1[A]) NewBatchQ(count int, target ...ecs.Entity) Query1[A]

NewBatchQ creates entities with the Map1's components. It returns a Query1 over the new entities.

The optional argument can be used to set the target ecs.Entity for the Map1's ecs.Relation.

Listener notification is delayed until the query is closed of fully iterated.

See also Map1.NewBatch and ecs.Builder.NewBatchQ.

func (*Map1[A]) NewWith added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map1's ecs.Relation.

See also ecs.NewBuilderWith.

func (*Map1[A]) Remove

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

Remove the Map1's components from the given entity.

The optional argument can be used to set the target ecs.Entity for the Map1's ecs.Relation.

See also ecs.World.Remove.

func (*Map1[A]) RemoveBatch added in v0.10.0

func (m *Map1[A]) RemoveBatch(filter ecs.Filter, target ...ecs.Entity) int

RemoveBatch removes the Map1's components from many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map1's ecs.Relation.

See also ecs.Batch.Remove.

func (*Map1[A]) RemoveBatchQ added in v0.10.0

func (m *Map1[A]) RemoveBatchQ(filter ecs.Filter, target ...ecs.Entity) Query0

RemoveBatchQ removes the Map1's components from multiple entities and returns a query over them, with no components.

The optional argument can be used to set the target ecs.Entity for the Map1's ecs.Relation.

See also ecs.Batch.RemoveQ.

func (*Map1[A]) RemoveEntities added in v0.6.0

func (m *Map1[A]) RemoveEntities(exclusive bool) int

RemoveEntities removes all entities from the world that match the Map1's components.

The argument determines whether to match the components exactly (i.e. no other components are allowed), or to use a simple filter that does not restrict further components.

Returns the number of removed entities.

See also ecs.Batch.RemoveEntities.

type Map10 added in v0.10.0

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

Map10 is a helper for mapping ten components.

Example

world := ecs.NewWorld()

mapper := NewMap10[A, B, C, D, E, F, G, H, I, J](&world)

entity := mapper.NewEntity()
a, b, c, d, e, f, g, h, i, j := mapper.Get(entity)

func NewMap10 added in v0.10.0

func NewMap10[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any](w *ecs.World, relation ...Comp) Map10[A, B, C, D, E, F, G, H, I, J]

NewMap10 creates a new Map10 object.

The optional argument can be used to set an ecs.Relation component type.

func (*Map10[A, B, C, D, E, F, G, H, I, J]) Add added in v0.10.0

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

Add the Map10's components to the given entity.

The optional argument can be used to set the target ecs.Entity for the Map10's ecs.Relation.

See also ecs.World.Add.

func (*Map10[A, B, C, D, E, F, G, H, I, J]) AddBatch added in v0.10.0

func (m *Map10[A, B, C, D, E, F, G, H, I, J]) AddBatch(filter ecs.Filter, target ...ecs.Entity) int

AddBatch adds the Map10's components to many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map10's ecs.Relation.

See also ecs.Batch.Add.

func (*Map10[A, B, C, D, E, F, G, H, I, J]) AddBatchQ added in v0.10.0

func (m *Map10[A, B, C, D, E, F, G, H, I, J]) AddBatchQ(filter ecs.Filter, target ...ecs.Entity) Query10[A, B, C, D, E, F, G, H, I, J]

AddBatchQ adds the Map10's components to multiple entities and returns a query over them and the newly added Map10's components.

The optional argument can be used to set the target ecs.Entity for the Map10's ecs.Relation.

See also ecs.Batch.AddQ.

func (*Map10[A, B, C, D, E, F, G, H, I, J]) Assign added in v0.10.0

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

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

See also ecs.World.Assign.

func (*Map10[A, B, C, D, E, F, G, H, I, J]) Get added in v0.10.0

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

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

See Map10.GetUnchecked for an optimized version for static entities. See also ecs.World.Get.

func (*Map10[A, B, C, D, E, F, G, H, I, J]) GetUnchecked added in v0.10.0

func (m *Map10[A, B, C, D, E, F, G, H, I, J]) GetUnchecked(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G, *H, *I, *J)

GetUnchecked all the Map10's components for the given entity.

GetUnchecked is an optimized version of Map10.Get, for cases where entities are static or checked with ecs.World.Alive in user code.

See also ecs.World.GetUnchecked.

func (*Map10[A, B, C, D, E, F, G, H, I, J]) New added in v0.10.0

func (m *Map10[A, B, C, D, E, F, G, H, I, J]) New(target ...ecs.Entity) ecs.Entity

New creates a new ecs.Entity with the Map10's components.

The optional argument can be used to set the target ecs.Entity for the Map10's ecs.Relation.

See also ecs.World.NewEntity.

func (*Map10[A, B, C, D, E, F, G, H, I, J]) NewBatch added in v0.10.0

func (m *Map10[A, B, C, D, E, F, G, H, I, J]) NewBatch(count int, target ...ecs.Entity)

NewBatch creates entities with the Map10's components.

The optional argument can be used to set the target ecs.Entity for the Map10's ecs.Relation.

See also Map10.NewBatchQ and ecs.Batch.NewBatch.

func (*Map10[A, B, C, D, E, F, G, H, I, J]) NewBatchQ added in v0.10.0

func (m *Map10[A, B, C, D, E, F, G, H, I, J]) NewBatchQ(count int, target ...ecs.Entity) Query10[A, B, C, D, E, F, G, H, I, J]

NewBatchQ creates entities with the Map10's components. It returns a Query10 over the new entities.

The optional argument can be used to set the target ecs.Entity for the Map10's ecs.Relation.

Listener notification is delayed until the query is closed of fully iterated.

See also Map10.NewBatch and ecs.Builder.NewBatchQ.

func (*Map10[A, B, C, D, E, F, G, H, I, J]) NewWith added in v0.10.0

func (m *Map10[A, B, C, D, E, F, G, H, I, J]) NewWith(a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I, j *J, target ...ecs.Entity) ecs.Entity

NewWith creates a new ecs.Entity with the Map10's components, using the supplied values.

The optional argument can be used to set the target ecs.Entity for the Map10's ecs.Relation.

See also ecs.NewBuilderWith.

func (*Map10[A, B, C, D, E, F, G, H, I, J]) Remove added in v0.10.0

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

Remove the Map10's components from the given entity.

The optional argument can be used to set the target ecs.Entity for the Map10's ecs.Relation.

See also ecs.World.Remove.

func (*Map10[A, B, C, D, E, F, G, H, I, J]) RemoveBatch added in v0.10.0

func (m *Map10[A, B, C, D, E, F, G, H, I, J]) RemoveBatch(filter ecs.Filter, target ...ecs.Entity) int

RemoveBatch removes the Map10's components from many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map10's ecs.Relation.

See also ecs.Batch.Remove.

func (*Map10[A, B, C, D, E, F, G, H, I, J]) RemoveBatchQ added in v0.10.0

func (m *Map10[A, B, C, D, E, F, G, H, I, J]) RemoveBatchQ(filter ecs.Filter, target ...ecs.Entity) Query0

RemoveBatchQ removes the Map10's components from multiple entities and returns a query over them, with no components.

The optional argument can be used to set the target ecs.Entity for the Map10's ecs.Relation.

See also ecs.Batch.RemoveQ.

func (*Map10[A, B, C, D, E, F, G, H, I, J]) RemoveEntities added in v0.10.0

func (m *Map10[A, B, C, D, E, F, G, H, I, J]) RemoveEntities(exclusive bool) int

RemoveEntities removes all entities from the world that match the Map10's components.

The argument determines whether to match the components exactly (i.e. no other components are allowed), or to use a simple filter that does not restrict further components.

Returns the number of removed entities.

See also ecs.Batch.RemoveEntities.

type Map11 added in v0.10.0

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

Map11 is a helper for mapping eleven components.

Example

world := ecs.NewWorld()

mapper := NewMap11[A, B, C, D, E, F, G, H, I, J, K](&world)

entity := mapper.NewEntity()
a, b, c, d, e, f, g, h, i, j, k := mapper.Get(entity)

func NewMap11 added in v0.10.0

func NewMap11[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any, K any](w *ecs.World, relation ...Comp) Map11[A, B, C, D, E, F, G, H, I, J, K]

NewMap11 creates a new Map11 object.

The optional argument can be used to set an ecs.Relation component type.

func (*Map11[A, B, C, D, E, F, G, H, I, J, K]) Add added in v0.10.0

func (m *Map11[A, B, C, D, E, F, G, H, I, J, K]) Add(entity ecs.Entity, target ...ecs.Entity)

Add the Map11's components to the given entity.

The optional argument can be used to set the target ecs.Entity for the Map11's ecs.Relation.

See also ecs.World.Add.

func (*Map11[A, B, C, D, E, F, G, H, I, J, K]) AddBatch added in v0.10.0

func (m *Map11[A, B, C, D, E, F, G, H, I, J, K]) AddBatch(filter ecs.Filter, target ...ecs.Entity) int

AddBatch adds the Map11's components to many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map11's ecs.Relation.

See also ecs.Batch.Add.

func (*Map11[A, B, C, D, E, F, G, H, I, J, K]) AddBatchQ added in v0.10.0

func (m *Map11[A, B, C, D, E, F, G, H, I, J, K]) AddBatchQ(filter ecs.Filter, target ...ecs.Entity) Query11[A, B, C, D, E, F, G, H, I, J, K]

AddBatchQ adds the Map11's components to multiple entities and returns a query over them and the newly added Map11's components.

The optional argument can be used to set the target ecs.Entity for the Map11's ecs.Relation.

See also ecs.Batch.AddQ.

func (*Map11[A, B, C, D, E, F, G, H, I, J, K]) Assign added in v0.10.0

func (m *Map11[A, B, C, D, E, F, G, H, I, J, K]) Assign(entity ecs.Entity, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I, j *J, k *K)

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

See also ecs.World.Assign.

func (*Map11[A, B, C, D, E, F, G, H, I, J, K]) Get added in v0.10.0

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

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

See Map11.GetUnchecked for an optimized version for static entities. See also ecs.World.Get.

func (*Map11[A, B, C, D, E, F, G, H, I, J, K]) GetUnchecked added in v0.10.0

func (m *Map11[A, B, C, D, E, F, G, H, I, J, K]) GetUnchecked(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G, *H, *I, *J, *K)

GetUnchecked all the Map11's components for the given entity.

GetUnchecked is an optimized version of Map11.Get, for cases where entities are static or checked with ecs.World.Alive in user code.

See also ecs.World.GetUnchecked.

func (*Map11[A, B, C, D, E, F, G, H, I, J, K]) New added in v0.10.0

func (m *Map11[A, B, C, D, E, F, G, H, I, J, K]) New(target ...ecs.Entity) ecs.Entity

New creates a new ecs.Entity with the Map11's components.

The optional argument can be used to set the target ecs.Entity for the Map11's ecs.Relation.

See also ecs.World.NewEntity.

func (*Map11[A, B, C, D, E, F, G, H, I, J, K]) NewBatch added in v0.10.0

func (m *Map11[A, B, C, D, E, F, G, H, I, J, K]) NewBatch(count int, target ...ecs.Entity)

NewBatch creates entities with the Map11's components.

The optional argument can be used to set the target ecs.Entity for the Map11's ecs.Relation.

See also Map11.NewBatchQ and ecs.Batch.NewBatch.

func (*Map11[A, B, C, D, E, F, G, H, I, J, K]) NewBatchQ added in v0.10.0

func (m *Map11[A, B, C, D, E, F, G, H, I, J, K]) NewBatchQ(count int, target ...ecs.Entity) Query11[A, B, C, D, E, F, G, H, I, J, K]

NewBatchQ creates entities with the Map11's components. It returns a Query11 over the new entities.

The optional argument can be used to set the target ecs.Entity for the Map11's ecs.Relation.

Listener notification is delayed until the query is closed of fully iterated.

See also Map11.NewBatch and ecs.Builder.NewBatchQ.

func (*Map11[A, B, C, D, E, F, G, H, I, J, K]) NewWith added in v0.10.0

func (m *Map11[A, B, C, D, E, F, G, H, I, J, K]) NewWith(a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I, j *J, k *K, target ...ecs.Entity) ecs.Entity

NewWith creates a new ecs.Entity with the Map11's components, using the supplied values.

The optional argument can be used to set the target ecs.Entity for the Map11's ecs.Relation.

See also ecs.NewBuilderWith.

func (*Map11[A, B, C, D, E, F, G, H, I, J, K]) Remove added in v0.10.0

func (m *Map11[A, B, C, D, E, F, G, H, I, J, K]) Remove(entity ecs.Entity, target ...ecs.Entity)

Remove the Map11's components from the given entity.

The optional argument can be used to set the target ecs.Entity for the Map11's ecs.Relation.

See also ecs.World.Remove.

func (*Map11[A, B, C, D, E, F, G, H, I, J, K]) RemoveBatch added in v0.10.0

func (m *Map11[A, B, C, D, E, F, G, H, I, J, K]) RemoveBatch(filter ecs.Filter, target ...ecs.Entity) int

RemoveBatch removes the Map11's components from many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map11's ecs.Relation.

See also ecs.Batch.Remove.

func (*Map11[A, B, C, D, E, F, G, H, I, J, K]) RemoveBatchQ added in v0.10.0

func (m *Map11[A, B, C, D, E, F, G, H, I, J, K]) RemoveBatchQ(filter ecs.Filter, target ...ecs.Entity) Query0

RemoveBatchQ removes the Map11's components from multiple entities and returns a query over them, with no components.

The optional argument can be used to set the target ecs.Entity for the Map11's ecs.Relation.

See also ecs.Batch.RemoveQ.

func (*Map11[A, B, C, D, E, F, G, H, I, J, K]) RemoveEntities added in v0.10.0

func (m *Map11[A, B, C, D, E, F, G, H, I, J, K]) RemoveEntities(exclusive bool) int

RemoveEntities removes all entities from the world that match the Map11's components.

The argument determines whether to match the components exactly (i.e. no other components are allowed), or to use a simple filter that does not restrict further components.

Returns the number of removed entities.

See also ecs.Batch.RemoveEntities.

type Map12 added in v0.10.0

type Map12[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any, K any, L any] struct {
	// contains filtered or unexported fields
}

Map12 is a helper for mapping twelve components.

Example

world := ecs.NewWorld()

mapper := NewMap12[A, B, C, D, E, F, G, H, I, J, K, L](&world)

entity := mapper.NewEntity()
a, b, c, d, e, f, g, h, i, j, k, l := mapper.Get(entity)

func NewMap12 added in v0.10.0

func NewMap12[A any, B any, C any, D any, E any, F any, G any, H any, I any, J any, K any, L any](w *ecs.World, relation ...Comp) Map12[A, B, C, D, E, F, G, H, I, J, K, L]

NewMap12 creates a new Map12 object.

The optional argument can be used to set an ecs.Relation component type.

func (*Map12[A, B, C, D, E, F, G, H, I, J, K, L]) Add added in v0.10.0

func (m *Map12[A, B, C, D, E, F, G, H, I, J, K, L]) Add(entity ecs.Entity, target ...ecs.Entity)

Add the Map12's components to the given entity.

The optional argument can be used to set the target ecs.Entity for the Map12's ecs.Relation.

See also ecs.World.Add.

func (*Map12[A, B, C, D, E, F, G, H, I, J, K, L]) AddBatch added in v0.10.0

func (m *Map12[A, B, C, D, E, F, G, H, I, J, K, L]) AddBatch(filter ecs.Filter, target ...ecs.Entity) int

AddBatch adds the Map12's components to many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map12's ecs.Relation.

See also ecs.Batch.Add.

func (*Map12[A, B, C, D, E, F, G, H, I, J, K, L]) AddBatchQ added in v0.10.0

func (m *Map12[A, B, C, D, E, F, G, H, I, J, K, L]) AddBatchQ(filter ecs.Filter, target ...ecs.Entity) Query12[A, B, C, D, E, F, G, H, I, J, K, L]

AddBatchQ adds the Map12's components to multiple entities and returns a query over them and the newly added Map12's components.

The optional argument can be used to set the target ecs.Entity for the Map12's ecs.Relation.

See also ecs.Batch.AddQ.

func (*Map12[A, B, C, D, E, F, G, H, I, J, K, L]) Assign added in v0.10.0

func (m *Map12[A, B, C, D, E, F, G, H, I, J, K, L]) Assign(entity ecs.Entity, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I, j *J, k *K, l *L)

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

See also ecs.World.Assign.

func (*Map12[A, B, C, D, E, F, G, H, I, J, K, L]) Get added in v0.10.0

func (m *Map12[A, B, C, D, E, F, G, H, I, J, K, L]) Get(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G, *H, *I, *J, *K, *L)

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

See Map12.GetUnchecked for an optimized version for static entities. See also ecs.World.Get.

func (*Map12[A, B, C, D, E, F, G, H, I, J, K, L]) GetUnchecked added in v0.10.0

func (m *Map12[A, B, C, D, E, F, G, H, I, J, K, L]) GetUnchecked(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G, *H, *I, *J, *K, *L)

GetUnchecked all the Map12's components for the given entity.

GetUnchecked is an optimized version of Map12.Get, for cases where entities are static or checked with ecs.World.Alive in user code.

See also ecs.World.GetUnchecked.

func (*Map12[A, B, C, D, E, F, G, H, I, J, K, L]) New added in v0.10.0

func (m *Map12[A, B, C, D, E, F, G, H, I, J, K, L]) New(target ...ecs.Entity) ecs.Entity

New creates a new ecs.Entity with the Map12's components.

The optional argument can be used to set the target ecs.Entity for the Map12's ecs.Relation.

See also ecs.World.NewEntity.

func (*Map12[A, B, C, D, E, F, G, H, I, J, K, L]) NewBatch added in v0.10.0

func (m *Map12[A, B, C, D, E, F, G, H, I, J, K, L]) NewBatch(count int, target ...ecs.Entity)

NewBatch creates entities with the Map12's components.

The optional argument can be used to set the target ecs.Entity for the Map12's ecs.Relation.

See also Map12.NewBatchQ and ecs.Batch.NewBatch.

func (*Map12[A, B, C, D, E, F, G, H, I, J, K, L]) NewBatchQ added in v0.10.0

func (m *Map12[A, B, C, D, E, F, G, H, I, J, K, L]) NewBatchQ(count int, target ...ecs.Entity) Query12[A, B, C, D, E, F, G, H, I, J, K, L]

NewBatchQ creates entities with the Map12's components. It returns a Query12 over the new entities.

The optional argument can be used to set the target ecs.Entity for the Map12's ecs.Relation.

Listener notification is delayed until the query is closed of fully iterated.

See also Map12.NewBatch and ecs.Builder.NewBatchQ.

func (*Map12[A, B, C, D, E, F, G, H, I, J, K, L]) NewWith added in v0.10.0

func (m *Map12[A, B, C, D, E, F, G, H, I, J, K, L]) NewWith(a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I, j *J, k *K, l *L, target ...ecs.Entity) ecs.Entity

NewWith creates a new ecs.Entity with the Map12's components, using the supplied values.

The optional argument can be used to set the target ecs.Entity for the Map12's ecs.Relation.

See also ecs.NewBuilderWith.

func (*Map12[A, B, C, D, E, F, G, H, I, J, K, L]) Remove added in v0.10.0

func (m *Map12[A, B, C, D, E, F, G, H, I, J, K, L]) Remove(entity ecs.Entity, target ...ecs.Entity)

Remove the Map12's components from the given entity.

The optional argument can be used to set the target ecs.Entity for the Map12's ecs.Relation.

See also ecs.World.Remove.

func (*Map12[A, B, C, D, E, F, G, H, I, J, K, L]) RemoveBatch added in v0.10.0

func (m *Map12[A, B, C, D, E, F, G, H, I, J, K, L]) RemoveBatch(filter ecs.Filter, target ...ecs.Entity) int

RemoveBatch removes the Map12's components from many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map12's ecs.Relation.

See also ecs.Batch.Remove.

func (*Map12[A, B, C, D, E, F, G, H, I, J, K, L]) RemoveBatchQ added in v0.10.0

func (m *Map12[A, B, C, D, E, F, G, H, I, J, K, L]) RemoveBatchQ(filter ecs.Filter, target ...ecs.Entity) Query0

RemoveBatchQ removes the Map12's components from multiple entities and returns a query over them, with no components.

The optional argument can be used to set the target ecs.Entity for the Map12's ecs.Relation.

See also ecs.Batch.RemoveQ.

func (*Map12[A, B, C, D, E, F, G, H, I, J, K, L]) RemoveEntities added in v0.10.0

func (m *Map12[A, B, C, D, E, F, G, H, I, J, K, L]) RemoveEntities(exclusive bool) int

RemoveEntities removes all entities from the world that match the Map12's components.

The argument determines whether to match the components exactly (i.e. no other components are allowed), or to use a simple filter that does not restrict further components.

Returns the number of removed entities.

See also ecs.Batch.RemoveEntities.

type Map2

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

Map2 is a helper for mapping two components.

Example

world := ecs.NewWorld()

mapper := NewMap2[A, B](&world)

entity := mapper.NewEntity()
a, b := mapper.Get(entity)

func NewMap2

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

NewMap2 creates a new Map2 object.

The optional argument can be used to set an ecs.Relation component type.

func (*Map2[A, B]) Add

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

Add the Map2's components to the given entity.

The optional argument can be used to set the target ecs.Entity for the Map2's ecs.Relation.

See also ecs.World.Add.

func (*Map2[A, B]) AddBatch added in v0.10.0

func (m *Map2[A, B]) AddBatch(filter ecs.Filter, target ...ecs.Entity) int

AddBatch adds the Map2's components to many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map2's ecs.Relation.

See also ecs.Batch.Add.

func (*Map2[A, B]) AddBatchQ added in v0.10.0

func (m *Map2[A, B]) AddBatchQ(filter ecs.Filter, target ...ecs.Entity) Query2[A, B]

AddBatchQ adds the Map2's components to multiple entities and returns a query over them and the newly added Map2's components.

The optional argument can be used to set the target ecs.Entity for the Map2's ecs.Relation.

See also ecs.Batch.AddQ.

func (*Map2[A, B]) Assign

func (m *Map2[A, B]) Assign(entity ecs.Entity, a *A, b *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 Map2.GetUnchecked for an optimized version for static entities. See also ecs.World.Get.

func (*Map2[A, B]) GetUnchecked added in v0.7.0

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

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

GetUnchecked is an optimized version of Map2.Get, for cases where entities are static or checked with ecs.World.Alive in user code.

See also ecs.World.GetUnchecked.

func (*Map2[A, B]) New added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map2's ecs.Relation.

See also ecs.World.NewEntity.

func (*Map2[A, B]) NewBatch added in v0.8.0

func (m *Map2[A, B]) NewBatch(count int, target ...ecs.Entity)

NewBatch creates entities with the Map2's components.

The optional argument can be used to set the target ecs.Entity for the Map2's ecs.Relation.

See also Map2.NewBatchQ and ecs.Batch.NewBatch.

func (*Map2[A, B]) NewBatchQ added in v0.8.0

func (m *Map2[A, B]) NewBatchQ(count int, target ...ecs.Entity) Query2[A, B]

NewBatchQ creates entities with the Map2's components. It returns a Query2 over the new entities.

The optional argument can be used to set the target ecs.Entity for the Map2's ecs.Relation.

Listener notification is delayed until the query is closed of fully iterated.

See also Map2.NewBatch and ecs.Builder.NewBatchQ.

func (*Map2[A, B]) NewWith added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map2's ecs.Relation.

See also ecs.NewBuilderWith.

func (*Map2[A, B]) Remove

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

Remove the Map2's components from the given entity.

The optional argument can be used to set the target ecs.Entity for the Map2's ecs.Relation.

See also ecs.World.Remove.

func (*Map2[A, B]) RemoveBatch added in v0.10.0

func (m *Map2[A, B]) RemoveBatch(filter ecs.Filter, target ...ecs.Entity) int

RemoveBatch removes the Map2's components from many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map2's ecs.Relation.

See also ecs.Batch.Remove.

func (*Map2[A, B]) RemoveBatchQ added in v0.10.0

func (m *Map2[A, B]) RemoveBatchQ(filter ecs.Filter, target ...ecs.Entity) Query0

RemoveBatchQ removes the Map2's components from multiple entities and returns a query over them, with no components.

The optional argument can be used to set the target ecs.Entity for the Map2's ecs.Relation.

See also ecs.Batch.RemoveQ.

func (*Map2[A, B]) RemoveEntities added in v0.6.0

func (m *Map2[A, B]) RemoveEntities(exclusive bool) int

RemoveEntities removes all entities from the world that match the Map2's components.

The argument determines whether to match the components exactly (i.e. no other components are allowed), or to use a simple filter that does not restrict further components.

Returns the number of removed entities.

See also ecs.Batch.RemoveEntities.

type Map3

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

Map3 is a helper for mapping three components.

Example

world := ecs.NewWorld()

mapper := NewMap3[A, B, C](&world)

entity := mapper.NewEntity()
a, b, c := mapper.Get(entity)

func NewMap3

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

NewMap3 creates a new Map3 object.

The optional argument can be used to set an ecs.Relation component type.

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

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

Add the Map3's components to the given entity.

The optional argument can be used to set the target ecs.Entity for the Map3's ecs.Relation.

See also ecs.World.Add.

func (*Map3[A, B, C]) AddBatch added in v0.10.0

func (m *Map3[A, B, C]) AddBatch(filter ecs.Filter, target ...ecs.Entity) int

AddBatch adds the Map3's components to many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map3's ecs.Relation.

See also ecs.Batch.Add.

func (*Map3[A, B, C]) AddBatchQ added in v0.10.0

func (m *Map3[A, B, C]) AddBatchQ(filter ecs.Filter, target ...ecs.Entity) Query3[A, B, C]

AddBatchQ adds the Map3's components to multiple entities and returns a query over them and the newly added Map3's components.

The optional argument can be used to set the target ecs.Entity for the Map3's ecs.Relation.

See also ecs.Batch.AddQ.

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

func (m *Map3[A, B, C]) Assign(entity ecs.Entity, a *A, b *B, c *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 Map3.GetUnchecked for an optimized version for static entities. See also ecs.World.Get.

func (*Map3[A, B, C]) GetUnchecked added in v0.7.0

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

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

GetUnchecked is an optimized version of Map3.Get, for cases where entities are static or checked with ecs.World.Alive in user code.

See also ecs.World.GetUnchecked.

func (*Map3[A, B, C]) New added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map3's ecs.Relation.

See also ecs.World.NewEntity.

func (*Map3[A, B, C]) NewBatch added in v0.8.0

func (m *Map3[A, B, C]) NewBatch(count int, target ...ecs.Entity)

NewBatch creates entities with the Map3's components.

The optional argument can be used to set the target ecs.Entity for the Map3's ecs.Relation.

See also Map3.NewBatchQ and ecs.Batch.NewBatch.

func (*Map3[A, B, C]) NewBatchQ added in v0.8.0

func (m *Map3[A, B, C]) NewBatchQ(count int, target ...ecs.Entity) Query3[A, B, C]

NewBatchQ creates entities with the Map3's components. It returns a Query3 over the new entities.

The optional argument can be used to set the target ecs.Entity for the Map3's ecs.Relation.

Listener notification is delayed until the query is closed of fully iterated.

See also Map3.NewBatch and ecs.Builder.NewBatchQ.

func (*Map3[A, B, C]) NewWith added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map3's ecs.Relation.

See also ecs.NewBuilderWith.

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

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

Remove the Map3's components from the given entity.

The optional argument can be used to set the target ecs.Entity for the Map3's ecs.Relation.

See also ecs.World.Remove.

func (*Map3[A, B, C]) RemoveBatch added in v0.10.0

func (m *Map3[A, B, C]) RemoveBatch(filter ecs.Filter, target ...ecs.Entity) int

RemoveBatch removes the Map3's components from many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map3's ecs.Relation.

See also ecs.Batch.Remove.

func (*Map3[A, B, C]) RemoveBatchQ added in v0.10.0

func (m *Map3[A, B, C]) RemoveBatchQ(filter ecs.Filter, target ...ecs.Entity) Query0

RemoveBatchQ removes the Map3's components from multiple entities and returns a query over them, with no components.

The optional argument can be used to set the target ecs.Entity for the Map3's ecs.Relation.

See also ecs.Batch.RemoveQ.

func (*Map3[A, B, C]) RemoveEntities added in v0.6.0

func (m *Map3[A, B, C]) RemoveEntities(exclusive bool) int

RemoveEntities removes all entities from the world that match the Map3's components.

The argument determines whether to match the components exactly (i.e. no other components are allowed), or to use a simple filter that does not restrict further components.

Returns the number of removed entities.

See also ecs.Batch.RemoveEntities.

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.

Example

world := ecs.NewWorld()

mapper := NewMap4[A, B, C, D](&world)

entity := mapper.NewEntity()
a, b, c, d := mapper.Get(entity)

func NewMap4

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

NewMap4 creates a new Map4 object.

The optional argument can be used to set an ecs.Relation component type.

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

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

Add the Map4's components to the given entity.

The optional argument can be used to set the target ecs.Entity for the Map4's ecs.Relation.

See also ecs.World.Add.

func (*Map4[A, B, C, D]) AddBatch added in v0.10.0

func (m *Map4[A, B, C, D]) AddBatch(filter ecs.Filter, target ...ecs.Entity) int

AddBatch adds the Map4's components to many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map4's ecs.Relation.

See also ecs.Batch.Add.

func (*Map4[A, B, C, D]) AddBatchQ added in v0.10.0

func (m *Map4[A, B, C, D]) AddBatchQ(filter ecs.Filter, target ...ecs.Entity) Query4[A, B, C, D]

AddBatchQ adds the Map4's components to multiple entities and returns a query over them and the newly added Map4's components.

The optional argument can be used to set the target ecs.Entity for the Map4's ecs.Relation.

See also ecs.Batch.AddQ.

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)

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 Map4.GetUnchecked for an optimized version for static entities. See also ecs.World.Get.

func (*Map4[A, B, C, D]) GetUnchecked added in v0.7.0

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

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

GetUnchecked is an optimized version of Map4.Get, for cases where entities are static or checked with ecs.World.Alive in user code.

See also ecs.World.GetUnchecked.

func (*Map4[A, B, C, D]) New added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map4's ecs.Relation.

See also ecs.World.NewEntity.

func (*Map4[A, B, C, D]) NewBatch added in v0.8.0

func (m *Map4[A, B, C, D]) NewBatch(count int, target ...ecs.Entity)

NewBatch creates entities with the Map4's components.

The optional argument can be used to set the target ecs.Entity for the Map4's ecs.Relation.

See also Map4.NewBatchQ and ecs.Batch.NewBatch.

func (*Map4[A, B, C, D]) NewBatchQ added in v0.8.0

func (m *Map4[A, B, C, D]) NewBatchQ(count int, target ...ecs.Entity) Query4[A, B, C, D]

NewBatchQ creates entities with the Map4's components. It returns a Query4 over the new entities.

The optional argument can be used to set the target ecs.Entity for the Map4's ecs.Relation.

Listener notification is delayed until the query is closed of fully iterated.

See also Map4.NewBatch and ecs.Builder.NewBatchQ.

func (*Map4[A, B, C, D]) NewWith added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map4's ecs.Relation.

See also ecs.NewBuilderWith.

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

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

Remove the Map4's components from the given entity.

The optional argument can be used to set the target ecs.Entity for the Map4's ecs.Relation.

See also ecs.World.Remove.

func (*Map4[A, B, C, D]) RemoveBatch added in v0.10.0

func (m *Map4[A, B, C, D]) RemoveBatch(filter ecs.Filter, target ...ecs.Entity) int

RemoveBatch removes the Map4's components from many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map4's ecs.Relation.

See also ecs.Batch.Remove.

func (*Map4[A, B, C, D]) RemoveBatchQ added in v0.10.0

func (m *Map4[A, B, C, D]) RemoveBatchQ(filter ecs.Filter, target ...ecs.Entity) Query0

RemoveBatchQ removes the Map4's components from multiple entities and returns a query over them, with no components.

The optional argument can be used to set the target ecs.Entity for the Map4's ecs.Relation.

See also ecs.Batch.RemoveQ.

func (*Map4[A, B, C, D]) RemoveEntities added in v0.6.0

func (m *Map4[A, B, C, D]) RemoveEntities(exclusive bool) int

RemoveEntities removes all entities from the world that match the Map4's components.

The argument determines whether to match the components exactly (i.e. no other components are allowed), or to use a simple filter that does not restrict further components.

Returns the number of removed entities.

See also ecs.Batch.RemoveEntities.

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.

Example

world := ecs.NewWorld()

mapper := NewMap5[A, B, C, D, E](&world)

entity := mapper.NewEntity()
a, b, c, d, e := mapper.Get(entity)

func NewMap5

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

NewMap5 creates a new Map5 object.

The optional argument can be used to set an ecs.Relation component type.

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

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

Add the Map5's components to the given entity.

The optional argument can be used to set the target ecs.Entity for the Map5's ecs.Relation.

See also ecs.World.Add.

func (*Map5[A, B, C, D, E]) AddBatch added in v0.10.0

func (m *Map5[A, B, C, D, E]) AddBatch(filter ecs.Filter, target ...ecs.Entity) int

AddBatch adds the Map5's components to many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map5's ecs.Relation.

See also ecs.Batch.Add.

func (*Map5[A, B, C, D, E]) AddBatchQ added in v0.10.0

func (m *Map5[A, B, C, D, E]) AddBatchQ(filter ecs.Filter, target ...ecs.Entity) Query5[A, B, C, D, E]

AddBatchQ adds the Map5's components to multiple entities and returns a query over them and the newly added Map5's components.

The optional argument can be used to set the target ecs.Entity for the Map5's ecs.Relation.

See also ecs.Batch.AddQ.

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)

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 Map5.GetUnchecked for an optimized version for static entities. See also ecs.World.Get.

func (*Map5[A, B, C, D, E]) GetUnchecked added in v0.7.0

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

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

GetUnchecked is an optimized version of Map5.Get, for cases where entities are static or checked with ecs.World.Alive in user code.

See also ecs.World.GetUnchecked.

func (*Map5[A, B, C, D, E]) New added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map5's ecs.Relation.

See also ecs.World.NewEntity.

func (*Map5[A, B, C, D, E]) NewBatch added in v0.8.0

func (m *Map5[A, B, C, D, E]) NewBatch(count int, target ...ecs.Entity)

NewBatch creates entities with the Map5's components.

The optional argument can be used to set the target ecs.Entity for the Map5's ecs.Relation.

See also Map5.NewBatchQ and ecs.Batch.NewBatch.

func (*Map5[A, B, C, D, E]) NewBatchQ added in v0.8.0

func (m *Map5[A, B, C, D, E]) NewBatchQ(count int, target ...ecs.Entity) Query5[A, B, C, D, E]

NewBatchQ creates entities with the Map5's components. It returns a Query5 over the new entities.

The optional argument can be used to set the target ecs.Entity for the Map5's ecs.Relation.

Listener notification is delayed until the query is closed of fully iterated.

See also Map5.NewBatch and ecs.Builder.NewBatchQ.

func (*Map5[A, B, C, D, E]) NewWith added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map5's ecs.Relation.

See also ecs.NewBuilderWith.

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

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

Remove the Map5's components from the given entity.

The optional argument can be used to set the target ecs.Entity for the Map5's ecs.Relation.

See also ecs.World.Remove.

func (*Map5[A, B, C, D, E]) RemoveBatch added in v0.10.0

func (m *Map5[A, B, C, D, E]) RemoveBatch(filter ecs.Filter, target ...ecs.Entity) int

RemoveBatch removes the Map5's components from many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map5's ecs.Relation.

See also ecs.Batch.Remove.

func (*Map5[A, B, C, D, E]) RemoveBatchQ added in v0.10.0

func (m *Map5[A, B, C, D, E]) RemoveBatchQ(filter ecs.Filter, target ...ecs.Entity) Query0

RemoveBatchQ removes the Map5's components from multiple entities and returns a query over them, with no components.

The optional argument can be used to set the target ecs.Entity for the Map5's ecs.Relation.

See also ecs.Batch.RemoveQ.

func (*Map5[A, B, C, D, E]) RemoveEntities added in v0.6.0

func (m *Map5[A, B, C, D, E]) RemoveEntities(exclusive bool) int

RemoveEntities removes all entities from the world that match the Map5's components.

The argument determines whether to match the components exactly (i.e. no other components are allowed), or to use a simple filter that does not restrict further components.

Returns the number of removed entities.

See also ecs.Batch.RemoveEntities.

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.

Example

world := ecs.NewWorld()

mapper := NewMap6[A, B, C, D, E, F](&world)

entity := mapper.NewEntity()
a, b, c, d, e, f := mapper.Get(entity)

func NewMap6

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

NewMap6 creates a new Map6 object.

The optional argument can be used to set an ecs.Relation component type.

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

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

Add the Map6's components to the given entity.

The optional argument can be used to set the target ecs.Entity for the Map6's ecs.Relation.

See also ecs.World.Add.

func (*Map6[A, B, C, D, E, F]) AddBatch added in v0.10.0

func (m *Map6[A, B, C, D, E, F]) AddBatch(filter ecs.Filter, target ...ecs.Entity) int

AddBatch adds the Map6's components to many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map6's ecs.Relation.

See also ecs.Batch.Add.

func (*Map6[A, B, C, D, E, F]) AddBatchQ added in v0.10.0

func (m *Map6[A, B, C, D, E, F]) AddBatchQ(filter ecs.Filter, target ...ecs.Entity) Query6[A, B, C, D, E, F]

AddBatchQ adds the Map6's components to multiple entities and returns a query over them and the newly added Map6's components.

The optional argument can be used to set the target ecs.Entity for the Map6's ecs.Relation.

See also ecs.Batch.AddQ.

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)

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 Map6.GetUnchecked for an optimized version for static entities. See also ecs.World.Get.

func (*Map6[A, B, C, D, E, F]) GetUnchecked added in v0.7.0

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

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

GetUnchecked is an optimized version of Map6.Get, for cases where entities are static or checked with ecs.World.Alive in user code.

See also ecs.World.GetUnchecked.

func (*Map6[A, B, C, D, E, F]) New added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map6's ecs.Relation.

See also ecs.World.NewEntity.

func (*Map6[A, B, C, D, E, F]) NewBatch added in v0.8.0

func (m *Map6[A, B, C, D, E, F]) NewBatch(count int, target ...ecs.Entity)

NewBatch creates entities with the Map6's components.

The optional argument can be used to set the target ecs.Entity for the Map6's ecs.Relation.

See also Map6.NewBatchQ and ecs.Batch.NewBatch.

func (*Map6[A, B, C, D, E, F]) NewBatchQ added in v0.8.0

func (m *Map6[A, B, C, D, E, F]) NewBatchQ(count int, target ...ecs.Entity) Query6[A, B, C, D, E, F]

NewBatchQ creates entities with the Map6's components. It returns a Query6 over the new entities.

The optional argument can be used to set the target ecs.Entity for the Map6's ecs.Relation.

Listener notification is delayed until the query is closed of fully iterated.

See also Map6.NewBatch and ecs.Builder.NewBatchQ.

func (*Map6[A, B, C, D, E, F]) NewWith added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map6's ecs.Relation.

See also ecs.NewBuilderWith.

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

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

Remove the Map6's components from the given entity.

The optional argument can be used to set the target ecs.Entity for the Map6's ecs.Relation.

See also ecs.World.Remove.

func (*Map6[A, B, C, D, E, F]) RemoveBatch added in v0.10.0

func (m *Map6[A, B, C, D, E, F]) RemoveBatch(filter ecs.Filter, target ...ecs.Entity) int

RemoveBatch removes the Map6's components from many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map6's ecs.Relation.

See also ecs.Batch.Remove.

func (*Map6[A, B, C, D, E, F]) RemoveBatchQ added in v0.10.0

func (m *Map6[A, B, C, D, E, F]) RemoveBatchQ(filter ecs.Filter, target ...ecs.Entity) Query0

RemoveBatchQ removes the Map6's components from multiple entities and returns a query over them, with no components.

The optional argument can be used to set the target ecs.Entity for the Map6's ecs.Relation.

See also ecs.Batch.RemoveQ.

func (*Map6[A, B, C, D, E, F]) RemoveEntities added in v0.6.0

func (m *Map6[A, B, C, D, E, F]) RemoveEntities(exclusive bool) int

RemoveEntities removes all entities from the world that match the Map6's components.

The argument determines whether to match the components exactly (i.e. no other components are allowed), or to use a simple filter that does not restrict further components.

Returns the number of removed entities.

See also ecs.Batch.RemoveEntities.

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.

Example

world := ecs.NewWorld()

mapper := NewMap7[A, B, C, D, E, F, G](&world)

entity := mapper.NewEntity()
a, b, c, d, e, f, g := mapper.Get(entity)

func NewMap7

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

NewMap7 creates a new Map7 object.

The optional argument can be used to set an ecs.Relation component type.

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

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

Add the Map7's components to the given entity.

The optional argument can be used to set the target ecs.Entity for the Map7's ecs.Relation.

See also ecs.World.Add.

func (*Map7[A, B, C, D, E, F, G]) AddBatch added in v0.10.0

func (m *Map7[A, B, C, D, E, F, G]) AddBatch(filter ecs.Filter, target ...ecs.Entity) int

AddBatch adds the Map7's components to many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map7's ecs.Relation.

See also ecs.Batch.Add.

func (*Map7[A, B, C, D, E, F, G]) AddBatchQ added in v0.10.0

func (m *Map7[A, B, C, D, E, F, G]) AddBatchQ(filter ecs.Filter, target ...ecs.Entity) Query7[A, B, C, D, E, F, G]

AddBatchQ adds the Map7's components to multiple entities and returns a query over them and the newly added Map7's components.

The optional argument can be used to set the target ecs.Entity for the Map7's ecs.Relation.

See also ecs.Batch.AddQ.

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)

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 Map7.GetUnchecked for an optimized version for static entities. See also ecs.World.Get.

func (*Map7[A, B, C, D, E, F, G]) GetUnchecked added in v0.7.0

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

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

GetUnchecked is an optimized version of Map7.Get, for cases where entities are static or checked with ecs.World.Alive in user code.

See also ecs.World.GetUnchecked.

func (*Map7[A, B, C, D, E, F, G]) New added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map7's ecs.Relation.

See also ecs.World.NewEntity.

func (*Map7[A, B, C, D, E, F, G]) NewBatch added in v0.8.0

func (m *Map7[A, B, C, D, E, F, G]) NewBatch(count int, target ...ecs.Entity)

NewBatch creates entities with the Map7's components.

The optional argument can be used to set the target ecs.Entity for the Map7's ecs.Relation.

See also Map7.NewBatchQ and ecs.Batch.NewBatch.

func (*Map7[A, B, C, D, E, F, G]) NewBatchQ added in v0.8.0

func (m *Map7[A, B, C, D, E, F, G]) NewBatchQ(count int, target ...ecs.Entity) Query7[A, B, C, D, E, F, G]

NewBatchQ creates entities with the Map7's components. It returns a Query7 over the new entities.

The optional argument can be used to set the target ecs.Entity for the Map7's ecs.Relation.

Listener notification is delayed until the query is closed of fully iterated.

See also Map7.NewBatch and ecs.Builder.NewBatchQ.

func (*Map7[A, B, C, D, E, F, G]) NewWith added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map7's ecs.Relation.

See also ecs.NewBuilderWith.

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

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

Remove the Map7's components from the given entity.

The optional argument can be used to set the target ecs.Entity for the Map7's ecs.Relation.

See also ecs.World.Remove.

func (*Map7[A, B, C, D, E, F, G]) RemoveBatch added in v0.10.0

func (m *Map7[A, B, C, D, E, F, G]) RemoveBatch(filter ecs.Filter, target ...ecs.Entity) int

RemoveBatch removes the Map7's components from many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map7's ecs.Relation.

See also ecs.Batch.Remove.

func (*Map7[A, B, C, D, E, F, G]) RemoveBatchQ added in v0.10.0

func (m *Map7[A, B, C, D, E, F, G]) RemoveBatchQ(filter ecs.Filter, target ...ecs.Entity) Query0

RemoveBatchQ removes the Map7's components from multiple entities and returns a query over them, with no components.

The optional argument can be used to set the target ecs.Entity for the Map7's ecs.Relation.

See also ecs.Batch.RemoveQ.

func (*Map7[A, B, C, D, E, F, G]) RemoveEntities added in v0.6.0

func (m *Map7[A, B, C, D, E, F, G]) RemoveEntities(exclusive bool) int

RemoveEntities removes all entities from the world that match the Map7's components.

The argument determines whether to match the components exactly (i.e. no other components are allowed), or to use a simple filter that does not restrict further components.

Returns the number of removed entities.

See also ecs.Batch.RemoveEntities.

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.

Example

world := ecs.NewWorld()

mapper := NewMap8[A, B, C, D, E, F, G, H](&world)

entity := mapper.NewEntity()
a, b, c, d, e, f, g, h := mapper.Get(entity)

func NewMap8

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

NewMap8 creates a new Map8 object.

The optional argument can be used to set an ecs.Relation component type.

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, target ...ecs.Entity)

Add the Map8's components to the given entity.

The optional argument can be used to set the target ecs.Entity for the Map8's ecs.Relation.

See also ecs.World.Add.

func (*Map8[A, B, C, D, E, F, G, H]) AddBatch added in v0.10.0

func (m *Map8[A, B, C, D, E, F, G, H]) AddBatch(filter ecs.Filter, target ...ecs.Entity) int

AddBatch adds the Map8's components to many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map8's ecs.Relation.

See also ecs.Batch.Add.

func (*Map8[A, B, C, D, E, F, G, H]) AddBatchQ added in v0.10.0

func (m *Map8[A, B, C, D, E, F, G, H]) AddBatchQ(filter ecs.Filter, target ...ecs.Entity) Query8[A, B, C, D, E, F, G, H]

AddBatchQ adds the Map8's components to multiple entities and returns a query over them and the newly added Map8's components.

The optional argument can be used to set the target ecs.Entity for the Map8's ecs.Relation.

See also ecs.Batch.AddQ.

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)

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 Map8.GetUnchecked for an optimized version for static entities. See also ecs.World.Get.

func (*Map8[A, B, C, D, E, F, G, H]) GetUnchecked added in v0.7.0

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

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

GetUnchecked is an optimized version of Map8.Get, for cases where entities are static or checked with ecs.World.Alive in user code.

See also ecs.World.GetUnchecked.

func (*Map8[A, B, C, D, E, F, G, H]) New added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map8's ecs.Relation.

See also ecs.World.NewEntity.

func (*Map8[A, B, C, D, E, F, G, H]) NewBatch added in v0.8.0

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

NewBatch creates entities with the Map8's components.

The optional argument can be used to set the target ecs.Entity for the Map8's ecs.Relation.

See also Map8.NewBatchQ and ecs.Batch.NewBatch.

func (*Map8[A, B, C, D, E, F, G, H]) NewBatchQ added in v0.8.0

func (m *Map8[A, B, C, D, E, F, G, H]) NewBatchQ(count int, target ...ecs.Entity) Query8[A, B, C, D, E, F, G, H]

NewBatchQ creates entities with the Map8's components. It returns a Query8 over the new entities.

The optional argument can be used to set the target ecs.Entity for the Map8's ecs.Relation.

Listener notification is delayed until the query is closed of fully iterated.

See also Map8.NewBatch and ecs.Builder.NewBatchQ.

func (*Map8[A, B, C, D, E, F, G, H]) NewWith added in v0.8.0

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

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

The optional argument can be used to set the target ecs.Entity for the Map8's ecs.Relation.

See also ecs.NewBuilderWith.

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, target ...ecs.Entity)

Remove the Map8's components from the given entity.

The optional argument can be used to set the target ecs.Entity for the Map8's ecs.Relation.

See also ecs.World.Remove.

func (*Map8[A, B, C, D, E, F, G, H]) RemoveBatch added in v0.10.0

func (m *Map8[A, B, C, D, E, F, G, H]) RemoveBatch(filter ecs.Filter, target ...ecs.Entity) int

RemoveBatch removes the Map8's components from many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map8's ecs.Relation.

See also ecs.Batch.Remove.

func (*Map8[A, B, C, D, E, F, G, H]) RemoveBatchQ added in v0.10.0

func (m *Map8[A, B, C, D, E, F, G, H]) RemoveBatchQ(filter ecs.Filter, target ...ecs.Entity) Query0

RemoveBatchQ removes the Map8's components from multiple entities and returns a query over them, with no components.

The optional argument can be used to set the target ecs.Entity for the Map8's ecs.Relation.

See also ecs.Batch.RemoveQ.

func (*Map8[A, B, C, D, E, F, G, H]) RemoveEntities added in v0.6.0

func (m *Map8[A, B, C, D, E, F, G, H]) RemoveEntities(exclusive bool) int

RemoveEntities removes all entities from the world that match the Map8's components.

The argument determines whether to match the components exactly (i.e. no other components are allowed), or to use a simple filter that does not restrict further components.

Returns the number of removed entities.

See also ecs.Batch.RemoveEntities.

type Map9 added in v0.10.0

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

Map9 is a helper for mapping nine components.

Example

world := ecs.NewWorld()

mapper := NewMap9[A, B, C, D, E, F, G, H, I](&world)

entity := mapper.NewEntity()
a, b, c, d, e, f, g, h, i := mapper.Get(entity)

func NewMap9 added in v0.10.0

func NewMap9[A any, B any, C any, D any, E any, F any, G any, H any, I any](w *ecs.World, relation ...Comp) Map9[A, B, C, D, E, F, G, H, I]

NewMap9 creates a new Map9 object.

The optional argument can be used to set an ecs.Relation component type.

func (*Map9[A, B, C, D, E, F, G, H, I]) Add added in v0.10.0

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

Add the Map9's components to the given entity.

The optional argument can be used to set the target ecs.Entity for the Map9's ecs.Relation.

See also ecs.World.Add.

func (*Map9[A, B, C, D, E, F, G, H, I]) AddBatch added in v0.10.0

func (m *Map9[A, B, C, D, E, F, G, H, I]) AddBatch(filter ecs.Filter, target ...ecs.Entity) int

AddBatch adds the Map9's components to many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map9's ecs.Relation.

See also ecs.Batch.Add.

func (*Map9[A, B, C, D, E, F, G, H, I]) AddBatchQ added in v0.10.0

func (m *Map9[A, B, C, D, E, F, G, H, I]) AddBatchQ(filter ecs.Filter, target ...ecs.Entity) Query9[A, B, C, D, E, F, G, H, I]

AddBatchQ adds the Map9's components to multiple entities and returns a query over them and the newly added Map9's components.

The optional argument can be used to set the target ecs.Entity for the Map9's ecs.Relation.

See also ecs.Batch.AddQ.

func (*Map9[A, B, C, D, E, F, G, H, I]) Assign added in v0.10.0

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

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

See also ecs.World.Assign.

func (*Map9[A, B, C, D, E, F, G, H, I]) Get added in v0.10.0

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

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

See Map9.GetUnchecked for an optimized version for static entities. See also ecs.World.Get.

func (*Map9[A, B, C, D, E, F, G, H, I]) GetUnchecked added in v0.10.0

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

GetUnchecked all the Map9's components for the given entity.

GetUnchecked is an optimized version of Map9.Get, for cases where entities are static or checked with ecs.World.Alive in user code.

See also ecs.World.GetUnchecked.

func (*Map9[A, B, C, D, E, F, G, H, I]) New added in v0.10.0

func (m *Map9[A, B, C, D, E, F, G, H, I]) New(target ...ecs.Entity) ecs.Entity

New creates a new ecs.Entity with the Map9's components.

The optional argument can be used to set the target ecs.Entity for the Map9's ecs.Relation.

See also ecs.World.NewEntity.

func (*Map9[A, B, C, D, E, F, G, H, I]) NewBatch added in v0.10.0

func (m *Map9[A, B, C, D, E, F, G, H, I]) NewBatch(count int, target ...ecs.Entity)

NewBatch creates entities with the Map9's components.

The optional argument can be used to set the target ecs.Entity for the Map9's ecs.Relation.

See also Map9.NewBatchQ and ecs.Batch.NewBatch.

func (*Map9[A, B, C, D, E, F, G, H, I]) NewBatchQ added in v0.10.0

func (m *Map9[A, B, C, D, E, F, G, H, I]) NewBatchQ(count int, target ...ecs.Entity) Query9[A, B, C, D, E, F, G, H, I]

NewBatchQ creates entities with the Map9's components. It returns a Query9 over the new entities.

The optional argument can be used to set the target ecs.Entity for the Map9's ecs.Relation.

Listener notification is delayed until the query is closed of fully iterated.

See also Map9.NewBatch and ecs.Builder.NewBatchQ.

func (*Map9[A, B, C, D, E, F, G, H, I]) NewWith added in v0.10.0

func (m *Map9[A, B, C, D, E, F, G, H, I]) NewWith(a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I, target ...ecs.Entity) ecs.Entity

NewWith creates a new ecs.Entity with the Map9's components, using the supplied values.

The optional argument can be used to set the target ecs.Entity for the Map9's ecs.Relation.

See also ecs.NewBuilderWith.

func (*Map9[A, B, C, D, E, F, G, H, I]) Remove added in v0.10.0

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

Remove the Map9's components from the given entity.

The optional argument can be used to set the target ecs.Entity for the Map9's ecs.Relation.

See also ecs.World.Remove.

func (*Map9[A, B, C, D, E, F, G, H, I]) RemoveBatch added in v0.10.0

func (m *Map9[A, B, C, D, E, F, G, H, I]) RemoveBatch(filter ecs.Filter, target ...ecs.Entity) int

RemoveBatch removes the Map9's components from many entities, matching a filter. Returns the number of affected entities.

The optional argument can be used to set the target ecs.Entity for the Map9's ecs.Relation.

See also ecs.Batch.Remove.

func (*Map9[A, B, C, D, E, F, G, H, I]) RemoveBatchQ added in v0.10.0

func (m *Map9[A, B, C, D, E, F, G, H, I]) RemoveBatchQ(filter ecs.Filter, target ...ecs.Entity) Query0

RemoveBatchQ removes the Map9's components from multiple entities and returns a query over them, with no components.

The optional argument can be used to set the target ecs.Entity for the Map9's ecs.Relation.

See also ecs.Batch.RemoveQ.

func (*Map9[A, B, C, D, E, F, G, H, I]) RemoveEntities added in v0.10.0

func (m *Map9[A, B, C, D, E, F, G, H, I]) RemoveEntities(exclusive bool) int

RemoveEntities removes all entities from the world that match the Map9's components.

The argument determines whether to match the components exactly (i.e. no other components are allowed), or to use a simple filter that does not restrict further components.

Returns the number of removed entities.

See also ecs.Batch.RemoveEntities.

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.

Example

world := ecs.NewWorld()

filter := NewFilter0()
query := filter.Query(&world)
for query.Next() {
	entity = query.Entity()
}

func (*Query0) Relation added in v0.8.0

func (q *Query0) Relation() ecs.Entity

Relation returns the target entity for the query's relation.

Panics if the entity does not have the given component, or if the component is not an ecs.Relation. Panics if the underlying Filter0 was not prepared for relations using Filter0.WithRelation.

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.

Example

world := ecs.NewWorld()

filter := NewFilter1[A]()
query := filter.Query(&world)
for query.Next() {
	entity = query.Entity()
	a := query.Get()
}

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.

func (*Query1[A]) Relation added in v0.8.0

func (q *Query1[A]) Relation() ecs.Entity

Relation returns the target entity for the query's relation.

Panics if the entity does not have the given component, or if the component is not an ecs.Relation. Panics if the underlying Filter1 was not prepared for relations using Filter1.WithRelation.

type Query10 added in v0.10.0

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

Query10 is a generic query iterator for ten components.

Create it with NewFilter10 and Filter10.Query.

Also has all methods of ecs.Query.

Example

world := ecs.NewWorld()

filter := NewFilter10[A, B, C, D, E, F, G, H, I, J]()
query := filter.Query(&world)
for query.Next() {
	entity = query.Entity()
	a, b, c, d, e, f, g, h, i, j := query.Get()
}

func (*Query10[A, B, C, D, E, F, G, H, I, J]) Get added in v0.10.0

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

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

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

func (*Query10[A, B, C, D, E, F, G, H, I, J]) Relation added in v0.10.0

func (q *Query10[A, B, C, D, E, F, G, H, I, J]) Relation() ecs.Entity

Relation returns the target entity for the query's relation.

Panics if the entity does not have the given component, or if the component is not an ecs.Relation. Panics if the underlying Filter10 was not prepared for relations using Filter10.WithRelation.

type Query11 added in v0.10.0

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

Query11 is a generic query iterator for eleven components.

Create it with NewFilter11 and Filter11.Query.

Also has all methods of ecs.Query.

Example

world := ecs.NewWorld()

filter := NewFilter11[A, B, C, D, E, F, G, H, I, J, K]()
query := filter.Query(&world)
for query.Next() {
	entity = query.Entity()
	a, b, c, d, e, f, g, h, i, j, k := query.Get()
}

func (*Query11[A, B, C, D, E, F, G, H, I, J, K]) Get added in v0.10.0

func (q *Query11[A, B, C, D, E, F, G, H, I, J, K]) Get() (*A, *B, *C, *D, *E, *F, *G, *H, *I, *J, *K)

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

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

func (*Query11[A, B, C, D, E, F, G, H, I, J, K]) Relation added in v0.10.0

func (q *Query11[A, B, C, D, E, F, G, H, I, J, K]) Relation() ecs.Entity

Relation returns the target entity for the query's relation.

Panics if the entity does not have the given component, or if the component is not an ecs.Relation. Panics if the underlying Filter11 was not prepared for relations using Filter11.WithRelation.

type Query12 added in v0.10.0

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

Query12 is a generic query iterator for twelve components.

Create it with NewFilter12 and Filter12.Query.

Also has all methods of ecs.Query.

Example

world := ecs.NewWorld()

filter := NewFilter12[A, B, C, D, E, F, G, H, I, J, K, L]()
query := filter.Query(&world)
for query.Next() {
	entity = query.Entity()
	a, b, c, d, e, f, g, h, i, j, k, l := query.Get()
}

func (*Query12[A, B, C, D, E, F, G, H, I, J, K, L]) Get added in v0.10.0

func (q *Query12[A, B, C, D, E, F, G, H, I, J, K, L]) Get() (*A, *B, *C, *D, *E, *F, *G, *H, *I, *J, *K, *L)

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

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

func (*Query12[A, B, C, D, E, F, G, H, I, J, K, L]) Relation added in v0.10.0

func (q *Query12[A, B, C, D, E, F, G, H, I, J, K, L]) Relation() ecs.Entity

Relation returns the target entity for the query's relation.

Panics if the entity does not have the given component, or if the component is not an ecs.Relation. Panics if the underlying Filter12 was not prepared for relations using Filter12.WithRelation.

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.

Example

world := ecs.NewWorld()

filter := NewFilter2[A, B]()
query := filter.Query(&world)
for query.Next() {
	entity = query.Entity()
	a, b := query.Get()
}

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.

func (*Query2[A, B]) Relation added in v0.8.0

func (q *Query2[A, B]) Relation() ecs.Entity

Relation returns the target entity for the query's relation.

Panics if the entity does not have the given component, or if the component is not an ecs.Relation. Panics if the underlying Filter2 was not prepared for relations using Filter2.WithRelation.

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.

Example

world := ecs.NewWorld()

filter := NewFilter3[A, B, C]()
query := filter.Query(&world)
for query.Next() {
	entity = query.Entity()
	a, b, c := query.Get()
}

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.

func (*Query3[A, B, C]) Relation added in v0.8.0

func (q *Query3[A, B, C]) Relation() ecs.Entity

Relation returns the target entity for the query's relation.

Panics if the entity does not have the given component, or if the component is not an ecs.Relation. Panics if the underlying Filter3 was not prepared for relations using Filter3.WithRelation.

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.

Example

world := ecs.NewWorld()

filter := NewFilter4[A, B, C, D]()
query := filter.Query(&world)
for query.Next() {
	entity = query.Entity()
	a, b, c, d := query.Get()
}

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.

func (*Query4[A, B, C, D]) Relation added in v0.8.0

func (q *Query4[A, B, C, D]) Relation() ecs.Entity

Relation returns the target entity for the query's relation.

Panics if the entity does not have the given component, or if the component is not an ecs.Relation. Panics if the underlying Filter4 was not prepared for relations using Filter4.WithRelation.

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.

Example

world := ecs.NewWorld()

filter := NewFilter5[A, B, C, D, E]()
query := filter.Query(&world)
for query.Next() {
	entity = query.Entity()
	a, b, c, d, e := query.Get()
}

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.

func (*Query5[A, B, C, D, E]) Relation added in v0.8.0

func (q *Query5[A, B, C, D, E]) Relation() ecs.Entity

Relation returns the target entity for the query's relation.

Panics if the entity does not have the given component, or if the component is not an ecs.Relation. Panics if the underlying Filter5 was not prepared for relations using Filter5.WithRelation.

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.

Example

world := ecs.NewWorld()

filter := NewFilter6[A, B, C, D, E, F]()
query := filter.Query(&world)
for query.Next() {
	entity = query.Entity()
	a, b, c, d, e, f := query.Get()
}

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.

func (*Query6[A, B, C, D, E, F]) Relation added in v0.8.0

func (q *Query6[A, B, C, D, E, F]) Relation() ecs.Entity

Relation returns the target entity for the query's relation.

Panics if the entity does not have the given component, or if the component is not an ecs.Relation. Panics if the underlying Filter6 was not prepared for relations using Filter6.WithRelation.

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.

Example

world := ecs.NewWorld()

filter := NewFilter7[A, B, C, D, E, F, G]()
query := filter.Query(&world)
for query.Next() {
	entity = query.Entity()
	a, b, c, d, e, f, g := query.Get()
}

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.

func (*Query7[A, B, C, D, E, F, G]) Relation added in v0.8.0

func (q *Query7[A, B, C, D, E, F, G]) Relation() ecs.Entity

Relation returns the target entity for the query's relation.

Panics if the entity does not have the given component, or if the component is not an ecs.Relation. Panics if the underlying Filter7 was not prepared for relations using Filter7.WithRelation.

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.

Example

world := ecs.NewWorld()

filter := NewFilter8[A, B, C, D, E, F, G, H]()
query := filter.Query(&world)
for query.Next() {
	entity = query.Entity()
	a, b, c, d, e, f, g, h := query.Get()
}

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.

func (*Query8[A, B, C, D, E, F, G, H]) Relation added in v0.8.0

func (q *Query8[A, B, C, D, E, F, G, H]) Relation() ecs.Entity

Relation returns the target entity for the query's relation.

Panics if the entity does not have the given component, or if the component is not an ecs.Relation. Panics if the underlying Filter8 was not prepared for relations using Filter8.WithRelation.

type Query9 added in v0.10.0

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

Query9 is a generic query iterator for nine components.

Create it with NewFilter9 and Filter9.Query.

Also has all methods of ecs.Query.

Example

world := ecs.NewWorld()

filter := NewFilter9[A, B, C, D, E, F, G, H, I]()
query := filter.Query(&world)
for query.Next() {
	entity = query.Entity()
	a, b, c, d, e, f, g, h, i := query.Get()
}

func (*Query9[A, B, C, D, E, F, G, H, I]) Get added in v0.10.0

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

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

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

func (*Query9[A, B, C, D, E, F, G, H, I]) Relation added in v0.10.0

func (q *Query9[A, B, C, D, E, F, G, H, I]) Relation() ecs.Entity

Relation returns the target entity for the query's relation.

Panics if the entity does not have the given component, or if the component is not an ecs.Relation. Panics if the underlying Filter9 was not prepared for relations using Filter9.WithRelation.

type Resource added in v0.5.0

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

Resource provides a type-safe way to access world resources.

Create one with NewResource.

Example
world := ecs.NewWorld()
myRes := Position{}

resAccess := NewResource[Position](&world)
resAccess.Add(&myRes)
res := resAccess.Get()
res.X, res.Y = 10, 5
Output:

func NewResource added in v0.5.0

func NewResource[T any](w *ecs.World) Resource[T]

NewResource creates a new Resource mapper for a resource type. This does not add a resource to the world, but only creates a mapper for resource access!

Resource provides a type-safe way to access a world resources.

See also ecs.World.Resources.

func (*Resource[T]) Add added in v0.5.0

func (g *Resource[T]) Add(res *T)

Add adds a resource to the world.

Panics if there is already a resource of the given type.

See also ecs.Resources.Add.

func (*Resource[T]) Get added in v0.5.0

func (g *Resource[T]) Get() *T

Get gets the resource of the given type.

Returns nil if there is no such resource.

See also ecs.Resources.Get.

func (*Resource[T]) Has added in v0.5.0

func (g *Resource[T]) Has() bool

Has returns whether the world has the resource type.

See also ecs.Resources.Has.

func (*Resource[T]) ID added in v0.5.0

func (g *Resource[T]) ID() ecs.ResID

ID returns the resource ecs.ResID for this Resource mapper.

func (*Resource[T]) Remove added in v0.5.0

func (g *Resource[T]) Remove()

Remove removes a resource from the world.

Panics if there is no resource of the given type.

See also ecs.Resources.Remove.

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