Documentation
¶
Overview ¶
Package generic contains Arche's generic API.
See the top level module github.com/mlange-42/arche for an overview.
Index ¶
- type Comp
- func T[A any]() Comp
- func T1[A any]() []Comp
- func T2[A any, B any]() []Comp
- func T3[A any, B any, C any]() []Comp
- func T4[A any, B any, C any, D any]() []Comp
- func T5[A any, B any, C any, D any, E any]() []Comp
- func T6[A any, B any, C any, D any, E any, F any]() []Comp
- func T7[A any, B any, C any, D any, E any, F any, G any]() []Comp
- func T8[A any, B any, C any, D any, E any, F any, G any, H any]() []Comp
- type Exchange
- type Filter0
- type Filter1
- func (q *Filter1[A]) Filter(w *ecs.World) ecs.MaskFilter
- func (q *Filter1[A]) Optional(mask ...Comp) *Filter1[A]
- func (q *Filter1[A]) Query(w *ecs.World) Query1[A]
- func (q *Filter1[A]) Register(w *ecs.World)
- func (q *Filter1[A]) Unregister(w *ecs.World)
- func (q *Filter1[A]) With(mask ...Comp) *Filter1[A]
- func (q *Filter1[A]) Without(mask ...Comp) *Filter1[A]
- type Filter2
- func (q *Filter2[A, B]) Filter(w *ecs.World) ecs.MaskFilter
- func (q *Filter2[A, B]) Optional(mask ...Comp) *Filter2[A, B]
- func (q *Filter2[A, B]) Query(w *ecs.World) Query2[A, B]
- func (q *Filter2[A, B]) Register(w *ecs.World)
- func (q *Filter2[A, B]) Unregister(w *ecs.World)
- func (q *Filter2[A, B]) With(mask ...Comp) *Filter2[A, B]
- func (q *Filter2[A, B]) Without(mask ...Comp) *Filter2[A, B]
- type Filter3
- func (q *Filter3[A, B, C]) Filter(w *ecs.World) ecs.MaskFilter
- func (q *Filter3[A, B, C]) Optional(mask ...Comp) *Filter3[A, B, C]
- func (q *Filter3[A, B, C]) Query(w *ecs.World) Query3[A, B, C]
- func (q *Filter3[A, B, C]) Register(w *ecs.World)
- func (q *Filter3[A, B, C]) Unregister(w *ecs.World)
- func (q *Filter3[A, B, C]) With(mask ...Comp) *Filter3[A, B, C]
- func (q *Filter3[A, B, C]) Without(mask ...Comp) *Filter3[A, B, C]
- type Filter4
- func (q *Filter4[A, B, C, D]) Filter(w *ecs.World) ecs.MaskFilter
- func (q *Filter4[A, B, C, D]) Optional(mask ...Comp) *Filter4[A, B, C, D]
- func (q *Filter4[A, B, C, D]) Query(w *ecs.World) Query4[A, B, C, D]
- func (q *Filter4[A, B, C, D]) Register(w *ecs.World)
- func (q *Filter4[A, B, C, D]) Unregister(w *ecs.World)
- func (q *Filter4[A, B, C, D]) With(mask ...Comp) *Filter4[A, B, C, D]
- func (q *Filter4[A, B, C, D]) Without(mask ...Comp) *Filter4[A, B, C, D]
- type Filter5
- func (q *Filter5[A, B, C, D, E]) Filter(w *ecs.World) ecs.MaskFilter
- func (q *Filter5[A, B, C, D, E]) Optional(mask ...Comp) *Filter5[A, B, C, D, E]
- func (q *Filter5[A, B, C, D, E]) Query(w *ecs.World) Query5[A, B, C, D, E]
- func (q *Filter5[A, B, C, D, E]) Register(w *ecs.World)
- func (q *Filter5[A, B, C, D, E]) Unregister(w *ecs.World)
- func (q *Filter5[A, B, C, D, E]) With(mask ...Comp) *Filter5[A, B, C, D, E]
- func (q *Filter5[A, B, C, D, E]) Without(mask ...Comp) *Filter5[A, B, C, D, E]
- type Filter6
- func (q *Filter6[A, B, C, D, E, F]) Filter(w *ecs.World) ecs.MaskFilter
- func (q *Filter6[A, B, C, D, E, F]) Optional(mask ...Comp) *Filter6[A, B, C, D, E, F]
- func (q *Filter6[A, B, C, D, E, F]) Query(w *ecs.World) Query6[A, B, C, D, E, F]
- func (q *Filter6[A, B, C, D, E, F]) Register(w *ecs.World)
- func (q *Filter6[A, B, C, D, E, F]) Unregister(w *ecs.World)
- func (q *Filter6[A, B, C, D, E, F]) With(mask ...Comp) *Filter6[A, B, C, D, E, F]
- func (q *Filter6[A, B, C, D, E, F]) Without(mask ...Comp) *Filter6[A, B, C, D, E, F]
- type Filter7
- func (q *Filter7[A, B, C, D, E, F, G]) Filter(w *ecs.World) ecs.MaskFilter
- func (q *Filter7[A, B, C, D, E, F, G]) Optional(mask ...Comp) *Filter7[A, B, C, D, E, F, G]
- func (q *Filter7[A, B, C, D, E, F, G]) Query(w *ecs.World) Query7[A, B, C, D, E, F, G]
- func (q *Filter7[A, B, C, D, E, F, G]) Register(w *ecs.World)
- func (q *Filter7[A, B, C, D, E, F, G]) Unregister(w *ecs.World)
- func (q *Filter7[A, B, C, D, E, F, G]) With(mask ...Comp) *Filter7[A, B, C, D, E, F, G]
- func (q *Filter7[A, B, C, D, E, F, G]) Without(mask ...Comp) *Filter7[A, B, C, D, E, F, G]
- type Filter8
- func (q *Filter8[A, B, C, D, E, F, G, H]) Filter(w *ecs.World) ecs.MaskFilter
- func (q *Filter8[A, B, C, D, E, F, G, H]) Optional(mask ...Comp) *Filter8[A, B, C, D, E, F, G, H]
- func (q *Filter8[A, B, C, D, E, F, G, H]) Query(w *ecs.World) Query8[A, B, C, D, E, F, G, H]
- func (q *Filter8[A, B, C, D, E, F, G, H]) Register(w *ecs.World)
- func (q *Filter8[A, B, C, D, E, F, G, H]) Unregister(w *ecs.World)
- func (q *Filter8[A, B, C, D, E, F, G, H]) With(mask ...Comp) *Filter8[A, B, C, D, E, F, G, H]
- func (q *Filter8[A, B, C, D, E, F, G, H]) Without(mask ...Comp) *Filter8[A, B, C, D, E, F, G, H]
- type Map
- type Map1
- func (m *Map1[A]) Add(entity ecs.Entity)
- func (m *Map1[A]) Assign(entity ecs.Entity, a *A)
- func (m *Map1[A]) Get(entity ecs.Entity) *A
- func (m *Map1[A]) NewEntities(count int)
- func (m *Map1[A]) NewEntitiesQuery(count int) Query1[A]
- func (m *Map1[A]) NewEntitiesWith(count int, a *A)
- func (m *Map1[A]) NewEntitiesWithQuery(count int, a *A) Query1[A]
- func (m *Map1[A]) NewEntity() ecs.Entity
- func (m *Map1[A]) NewEntityWith(a *A) ecs.Entity
- func (m *Map1[A]) Remove(entity ecs.Entity)
- func (m *Map1[A]) RemoveEntities(exclusive bool) int
- type Map2
- func (m *Map2[A, B]) Add(entity ecs.Entity)
- func (m *Map2[A, B]) Assign(entity ecs.Entity, a *A, b *B)
- func (m *Map2[A, B]) Get(entity ecs.Entity) (*A, *B)
- func (m *Map2[A, B]) NewEntities(count int)
- func (m *Map2[A, B]) NewEntitiesQuery(count int) Query2[A, B]
- func (m *Map2[A, B]) NewEntitiesWith(count int, a *A, b *B)
- func (m *Map2[A, B]) NewEntitiesWithQuery(count int, a *A, b *B) Query2[A, B]
- func (m *Map2[A, B]) NewEntity() ecs.Entity
- func (m *Map2[A, B]) NewEntityWith(a *A, b *B) ecs.Entity
- func (m *Map2[A, B]) Remove(entity ecs.Entity)
- func (m *Map2[A, B]) RemoveEntities(exclusive bool) int
- type Map3
- func (m *Map3[A, B, C]) Add(entity ecs.Entity)
- func (m *Map3[A, B, C]) Assign(entity ecs.Entity, a *A, b *B, c *C)
- func (m *Map3[A, B, C]) Get(entity ecs.Entity) (*A, *B, *C)
- func (m *Map3[A, B, C]) NewEntities(count int)
- func (m *Map3[A, B, C]) NewEntitiesQuery(count int) Query3[A, B, C]
- func (m *Map3[A, B, C]) NewEntitiesWith(count int, a *A, b *B, c *C)
- func (m *Map3[A, B, C]) NewEntitiesWithQuery(count int, a *A, b *B, c *C) Query3[A, B, C]
- func (m *Map3[A, B, C]) NewEntity() ecs.Entity
- func (m *Map3[A, B, C]) NewEntityWith(a *A, b *B, c *C) ecs.Entity
- func (m *Map3[A, B, C]) Remove(entity ecs.Entity)
- func (m *Map3[A, B, C]) RemoveEntities(exclusive bool) int
- type Map4
- func (m *Map4[A, B, C, D]) Add(entity ecs.Entity)
- func (m *Map4[A, B, C, D]) Assign(entity ecs.Entity, a *A, b *B, c *C, d *D)
- func (m *Map4[A, B, C, D]) Get(entity ecs.Entity) (*A, *B, *C, *D)
- func (m *Map4[A, B, C, D]) NewEntities(count int)
- func (m *Map4[A, B, C, D]) NewEntitiesQuery(count int) Query4[A, B, C, D]
- func (m *Map4[A, B, C, D]) NewEntitiesWith(count int, a *A, b *B, c *C, d *D)
- func (m *Map4[A, B, C, D]) NewEntitiesWithQuery(count int, a *A, b *B, c *C, d *D) Query4[A, B, C, D]
- func (m *Map4[A, B, C, D]) NewEntity() ecs.Entity
- func (m *Map4[A, B, C, D]) NewEntityWith(a *A, b *B, c *C, d *D) ecs.Entity
- func (m *Map4[A, B, C, D]) Remove(entity ecs.Entity)
- func (m *Map4[A, B, C, D]) RemoveEntities(exclusive bool) int
- type Map5
- func (m *Map5[A, B, C, D, E]) Add(entity ecs.Entity)
- func (m *Map5[A, B, C, D, E]) Assign(entity ecs.Entity, a *A, b *B, c *C, d *D, e *E)
- func (m *Map5[A, B, C, D, E]) Get(entity ecs.Entity) (*A, *B, *C, *D, *E)
- func (m *Map5[A, B, C, D, E]) NewEntities(count int)
- func (m *Map5[A, B, C, D, E]) NewEntitiesQuery(count int) Query5[A, B, C, D, E]
- func (m *Map5[A, B, C, D, E]) NewEntitiesWith(count int, a *A, b *B, c *C, d *D, e *E)
- func (m *Map5[A, B, C, D, E]) NewEntitiesWithQuery(count int, a *A, b *B, c *C, d *D, e *E) Query5[A, B, C, D, E]
- func (m *Map5[A, B, C, D, E]) NewEntity() ecs.Entity
- func (m *Map5[A, B, C, D, E]) NewEntityWith(a *A, b *B, c *C, d *D, e *E) ecs.Entity
- func (m *Map5[A, B, C, D, E]) Remove(entity ecs.Entity)
- func (m *Map5[A, B, C, D, E]) RemoveEntities(exclusive bool) int
- type Map6
- func (m *Map6[A, B, C, D, E, F]) Add(entity ecs.Entity)
- 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)
- func (m *Map6[A, B, C, D, E, F]) Get(entity ecs.Entity) (*A, *B, *C, *D, *E, *F)
- func (m *Map6[A, B, C, D, E, F]) NewEntities(count int)
- func (m *Map6[A, B, C, D, E, F]) NewEntitiesQuery(count int) Query6[A, B, C, D, E, F]
- func (m *Map6[A, B, C, D, E, F]) NewEntitiesWith(count int, a *A, b *B, c *C, d *D, e *E, f *F)
- func (m *Map6[A, B, C, D, E, F]) NewEntitiesWithQuery(count int, a *A, b *B, c *C, d *D, e *E, f *F) Query6[A, B, C, D, E, F]
- func (m *Map6[A, B, C, D, E, F]) NewEntity() ecs.Entity
- func (m *Map6[A, B, C, D, E, F]) NewEntityWith(a *A, b *B, c *C, d *D, e *E, f *F) ecs.Entity
- func (m *Map6[A, B, C, D, E, F]) Remove(entity ecs.Entity)
- func (m *Map6[A, B, C, D, E, F]) RemoveEntities(exclusive bool) int
- type Map7
- func (m *Map7[A, B, C, D, E, F, G]) Add(entity ecs.Entity)
- 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)
- func (m *Map7[A, B, C, D, E, F, G]) Get(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G)
- func (m *Map7[A, B, C, D, E, F, G]) NewEntities(count int)
- func (m *Map7[A, B, C, D, E, F, G]) NewEntitiesQuery(count int) Query7[A, B, C, D, E, F, G]
- func (m *Map7[A, B, C, D, E, F, G]) NewEntitiesWith(count int, a *A, b *B, c *C, d *D, e *E, f *F, g *G)
- func (m *Map7[A, B, C, D, E, F, G]) NewEntitiesWithQuery(count int, a *A, b *B, c *C, d *D, e *E, f *F, g *G) Query7[A, B, C, D, E, F, G]
- func (m *Map7[A, B, C, D, E, F, G]) NewEntity() ecs.Entity
- func (m *Map7[A, B, C, D, E, F, G]) NewEntityWith(a *A, b *B, c *C, d *D, e *E, f *F, g *G) ecs.Entity
- func (m *Map7[A, B, C, D, E, F, G]) Remove(entity ecs.Entity)
- func (m *Map7[A, B, C, D, E, F, G]) RemoveEntities(exclusive bool) int
- type Map8
- func (m *Map8[A, B, C, D, E, F, G, H]) Add(entity ecs.Entity)
- 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)
- func (m *Map8[A, B, C, D, E, F, G, H]) Get(entity ecs.Entity) (*A, *B, *C, *D, *E, *F, *G, *H)
- func (m *Map8[A, B, C, D, E, F, G, H]) NewEntities(count int)
- func (m *Map8[A, B, C, D, E, F, G, H]) NewEntitiesQuery(count int) Query8[A, B, C, D, E, F, G, H]
- func (m *Map8[A, B, C, D, E, F, G, H]) NewEntitiesWith(count int, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H)
- func (m *Map8[A, B, C, D, E, F, G, H]) NewEntitiesWithQuery(count int, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H) Query8[A, B, C, D, E, F, G, H]
- func (m *Map8[A, B, C, D, E, F, G, H]) NewEntity() ecs.Entity
- func (m *Map8[A, B, C, D, E, F, G, H]) NewEntityWith(a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H) ecs.Entity
- func (m *Map8[A, B, C, D, E, F, G, H]) Remove(entity ecs.Entity)
- func (m *Map8[A, B, C, D, E, F, G, H]) RemoveEntities(exclusive bool) int
- type Query0
- type Query1
- type Query2
- type Query3
- type Query4
- type Query5
- type Query6
- type Query7
- type Query8
- type Resource
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comp ¶
Comp is an alias for 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 ¶
NewExchange creates a new Exchange object.
func (*Exchange) Add ¶
Add the components set via Exchange.Adds to the given entity.
See also ecs.World.Add.
func (*Exchange) Adds ¶
Adds sets components to add in calls to Exchange.Add and Exchange.Exchange.
Create the required mask items with T.
func (*Exchange) Exchange ¶
Exchange components on an entity.
Removes the components set via Exchange.Removes. Adds the components set via Exchange.Adds.
See also ecs.World.Exchange.
func (*Exchange) NewEntity ¶
NewEntity creates a new ecs.Entity with the components set via Exchange.Adds.
See also ecs.World.NewEntity.
func (*Exchange) Remove ¶
Remove the components set via Exchange.Removes from the given entity.
See also ecs.World.Remove.
func (*Exchange) Removes ¶
Removes sets components to remove in calls to Exchange.Remove and Exchange.Exchange.
Create the required mask items with T.
type Filter0 ¶
type Filter0 filter
Filter0 is a helper for building Query0 query iterators.
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) Filter ¶
func (q *Filter0) Filter(w *ecs.World) ecs.MaskFilter
Filter generates and return the ecs.Filter used after Filter0.Query.
Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter0.Query.
func (*Filter0) Register ¶ added in v0.6.0
Register the filter for caching.
See ecs.Cache for details on filter caching.
func (*Filter0) Unregister ¶ added in v0.6.0
Unregister the filter from caching.
See ecs.Cache for details on filter caching.
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 ¶
NewFilter1 creates a generic Filter1 for one components.
See also ecs.World.Query.
func (*Filter1[A]) Filter ¶
func (q *Filter1[A]) Filter(w *ecs.World) ecs.MaskFilter
Filter generates and return the ecs.Filter used after Filter1.Query.
Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter1.Query.
func (*Filter1[A]) Optional ¶
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]) Register ¶ added in v0.6.0
Register the filter for caching.
See ecs.Cache for details on filter caching.
func (*Filter1[A]) Unregister ¶ added in v0.6.0
Unregister the filter from caching.
See ecs.Cache for details on filter caching.
func (*Filter1[A]) With ¶
With adds components that are required, but not accessible via Query1.Get.
Create the required mask items with T.
type Filter2 ¶
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 ¶
NewFilter2 creates a generic Filter2 for two components.
See also ecs.World.Query.
func (*Filter2[A, B]) Filter ¶
func (q *Filter2[A, B]) Filter(w *ecs.World) ecs.MaskFilter
Filter generates and return the ecs.Filter used after Filter2.Query.
Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter2.Query.
func (*Filter2[A, B]) Optional ¶
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]) Register ¶ added in v0.6.0
Register the filter for caching.
See ecs.Cache for details on filter caching.
func (*Filter2[A, B]) Unregister ¶ added in v0.6.0
Unregister the filter from caching.
See ecs.Cache for details on filter caching.
func (*Filter2[A, B]) With ¶
With adds components that are required, but not accessible via Query2.Get.
Create the required mask items with T.
type Filter3 ¶
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 ¶
NewFilter3 creates a generic Filter3 for three components.
See also ecs.World.Query.
func (*Filter3[A, B, C]) Filter ¶
func (q *Filter3[A, B, C]) Filter(w *ecs.World) ecs.MaskFilter
Filter generates and return the ecs.Filter used after Filter3.Query.
Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter3.Query.
func (*Filter3[A, B, C]) Optional ¶
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]) Register ¶ added in v0.6.0
Register the filter for caching.
See ecs.Cache for details on filter caching.
func (*Filter3[A, B, C]) Unregister ¶ added in v0.6.0
Unregister the filter from caching.
See ecs.Cache for details on filter caching.
func (*Filter3[A, B, C]) With ¶
With adds components that are required, but not accessible via Query3.Get.
Create the required mask items with T.
type Filter4 ¶
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 ¶
NewFilter4 creates a generic Filter4 for four components.
See also ecs.World.Query.
func (*Filter4[A, B, C, D]) Filter ¶
func (q *Filter4[A, B, C, D]) Filter(w *ecs.World) ecs.MaskFilter
Filter generates and return the ecs.Filter used after Filter4.Query.
Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter4.Query.
func (*Filter4[A, B, C, D]) Optional ¶
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]) Register ¶ added in v0.6.0
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
Unregister the filter from caching.
See ecs.Cache for details on filter caching.
func (*Filter4[A, B, C, D]) With ¶
With adds components that are required, but not accessible via Query4.Get.
Create the required mask items with T.
type Filter5 ¶
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 ¶
NewFilter5 creates a generic Filter5 for five components.
See also ecs.World.Query.
func (*Filter5[A, B, C, D, E]) Filter ¶
func (q *Filter5[A, B, C, D, E]) Filter(w *ecs.World) ecs.MaskFilter
Filter generates and return the ecs.Filter used after Filter5.Query.
Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter5.Query.
func (*Filter5[A, B, C, D, E]) Optional ¶
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]) Register ¶ added in v0.6.0
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
Unregister the filter from caching.
See ecs.Cache for details on filter caching.
func (*Filter5[A, B, C, D, E]) With ¶
With adds components that are required, but not accessible via Query5.Get.
Create the required mask items with T.
type Filter6 ¶
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 ¶
NewFilter6 creates a generic Filter6 for six components.
See also ecs.World.Query.
func (*Filter6[A, B, C, D, E, F]) Filter ¶
func (q *Filter6[A, B, C, D, E, F]) Filter(w *ecs.World) ecs.MaskFilter
Filter generates and return the ecs.Filter used after Filter6.Query.
Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter6.Query.
func (*Filter6[A, B, C, D, E, F]) Optional ¶
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]) Register ¶ added in v0.6.0
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
Unregister the filter from caching.
See ecs.Cache for details on filter caching.
func (*Filter6[A, B, C, D, E, F]) With ¶
With adds components that are required, but not accessible via Query6.Get.
Create the required mask items with T.
type Filter7 ¶
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 ¶
NewFilter7 creates a generic Filter7 for seven components.
See also ecs.World.Query.
func (*Filter7[A, B, C, D, E, F, G]) Filter ¶
func (q *Filter7[A, B, C, D, E, F, G]) Filter(w *ecs.World) ecs.MaskFilter
Filter generates and return the ecs.Filter used after Filter7.Query.
Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter7.Query.
func (*Filter7[A, B, C, D, E, F, G]) Optional ¶
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]) Register ¶ added in v0.6.0
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
Unregister the filter from caching.
See ecs.Cache for details on filter caching.
func (*Filter7[A, B, C, D, E, F, G]) With ¶
With adds components that are required, but not accessible via Query7.Get.
Create the required mask items with T.
type Filter8 ¶
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]) Filter ¶
func (q *Filter8[A, B, C, D, E, F, G, H]) Filter(w *ecs.World) ecs.MaskFilter
Filter generates and return the ecs.Filter used after Filter8.Query.
Can be passed to ecs.World.Query. For the intended generic use, however, generate a generic query with Filter8.Query.
func (*Filter8[A, B, C, D, E, F, G, H]) Optional ¶
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]) Register ¶ added in v0.6.0
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
Unregister the filter from caching.
See ecs.Cache for details on filter caching.
func (*Filter8[A, B, C, D, E, F, G, H]) With ¶
With adds components that are required, but not accessible via Query8.Get.
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 ¶
world := ecs.NewWorld() spawner := NewMap2[Position, Velocity](&world) entity := spawner.NewEntity() mapper := NewMap[Position](&world) pos := mapper.Get(entity) pos.X, pos.Y = 10, 5
Output:
func NewMap ¶
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.
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 (*Map1[A]) Assign ¶
Assign the Map1's components to the given entity, using the supplied values.
See also ecs.World.Assign.
func (*Map1[A]) NewEntities ¶ added in v0.6.0
NewEntities creates entities with the Map1's components.
See also Map1.NewEntitiesQuery and ecs.Batch.NewEntities.
func (*Map1[A]) NewEntitiesQuery ¶ added in v0.6.0
NewEntities creates entities with the Map1's components. It returns a Query1 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map1.NewEntities and ecs.Batch.NewEntitiesQuery.
func (*Map1[A]) NewEntitiesWith ¶ added in v0.6.0
NewEntitiesWith creates entities with the Map1's components, using the supplied values.
See also Map1.NewEntitiesWithQuery and ecs.Batch.NewEntitiesWith.
func (*Map1[A]) NewEntitiesWithQuery ¶ added in v0.6.0
NewEntitiesWithQuery creates entities with the Map1's components, using the supplied values. It returns a Query1 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map1.NewEntitiesWith and ecs.Batch.NewEntitiesWithQuery.
func (*Map1[A]) NewEntity ¶
NewEntity creates a new ecs.Entity with the Map1's components.
See also ecs.World.NewEntity.
func (*Map1[A]) NewEntityWith ¶
NewEntityWith creates a new ecs.Entity with the Map1's components, using the supplied values.
See also ecs.World.NewEntityWith.
func (*Map1[A]) Remove ¶
Remove the Map1's components from the given entity.
See also ecs.World.Remove.
func (*Map1[A]) RemoveEntities ¶ added in v0.6.0
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.World.NewEntityWith.
type Map2 ¶
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 (*Map2[A, B]) Assign ¶
Assign the Map2's components to the given entity, using the supplied values.
See also ecs.World.Assign.
func (*Map2[A, B]) Get ¶
Get all the Map2's components for the given entity.
See also ecs.World.Get.
func (*Map2[A, B]) NewEntities ¶ added in v0.6.0
NewEntities creates entities with the Map2's components.
See also Map2.NewEntitiesQuery and ecs.Batch.NewEntities.
func (*Map2[A, B]) NewEntitiesQuery ¶ added in v0.6.0
NewEntities creates entities with the Map2's components. It returns a Query2 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map2.NewEntities and ecs.Batch.NewEntitiesQuery.
func (*Map2[A, B]) NewEntitiesWith ¶ added in v0.6.0
NewEntitiesWith creates entities with the Map2's components, using the supplied values.
See also Map2.NewEntitiesWithQuery and ecs.Batch.NewEntitiesWith.
func (*Map2[A, B]) NewEntitiesWithQuery ¶ added in v0.6.0
NewEntitiesWithQuery creates entities with the Map2's components, using the supplied values. It returns a Query2 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map2.NewEntitiesWith and ecs.Batch.NewEntitiesWithQuery.
func (*Map2[A, B]) NewEntity ¶
NewEntity creates a new ecs.Entity with the Map2's components.
See also ecs.World.NewEntity.
func (*Map2[A, B]) NewEntityWith ¶
NewEntityWith creates a new ecs.Entity with the Map2's components, using the supplied values.
See also ecs.World.NewEntityWith.
func (*Map2[A, B]) Remove ¶
Remove the Map2's components from the given entity.
See also ecs.World.Remove.
func (*Map2[A, B]) RemoveEntities ¶ added in v0.6.0
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.World.NewEntityWith.
type Map3 ¶
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 (*Map3[A, B, C]) Assign ¶
Assign the Map3's components to the given entity, using the supplied values.
See also ecs.World.Assign.
func (*Map3[A, B, C]) Get ¶
Get all the Map3's components for the given entity.
See also ecs.World.Get.
func (*Map3[A, B, C]) NewEntities ¶ added in v0.6.0
NewEntities creates entities with the Map3's components.
See also Map3.NewEntitiesQuery and ecs.Batch.NewEntities.
func (*Map3[A, B, C]) NewEntitiesQuery ¶ added in v0.6.0
NewEntities creates entities with the Map3's components. It returns a Query3 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map3.NewEntities and ecs.Batch.NewEntitiesQuery.
func (*Map3[A, B, C]) NewEntitiesWith ¶ added in v0.6.0
NewEntitiesWith creates entities with the Map3's components, using the supplied values.
See also Map3.NewEntitiesWithQuery and ecs.Batch.NewEntitiesWith.
func (*Map3[A, B, C]) NewEntitiesWithQuery ¶ added in v0.6.0
NewEntitiesWithQuery creates entities with the Map3's components, using the supplied values. It returns a Query3 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map3.NewEntitiesWith and ecs.Batch.NewEntitiesWithQuery.
func (*Map3[A, B, C]) NewEntity ¶
NewEntity creates a new ecs.Entity with the Map3's components.
See also ecs.World.NewEntity.
func (*Map3[A, B, C]) NewEntityWith ¶
NewEntityWith creates a new ecs.Entity with the Map3's components, using the supplied values.
See also ecs.World.NewEntityWith.
func (*Map3[A, B, C]) Remove ¶
Remove the Map3's components from the given entity.
See also ecs.World.Remove.
func (*Map3[A, B, C]) RemoveEntities ¶ added in v0.6.0
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.World.NewEntityWith.
type Map4 ¶
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 (*Map4[A, B, C, D]) Add ¶
Add the Map4's components to the given entity.
See also ecs.World.Add.
func (*Map4[A, B, C, D]) Assign ¶
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 ¶
Get all the Map4's components for the given entity.
See also ecs.World.Get.
func (*Map4[A, B, C, D]) NewEntities ¶ added in v0.6.0
NewEntities creates entities with the Map4's components.
See also Map4.NewEntitiesQuery and ecs.Batch.NewEntities.
func (*Map4[A, B, C, D]) NewEntitiesQuery ¶ added in v0.6.0
NewEntities creates entities with the Map4's components. It returns a Query4 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map4.NewEntities and ecs.Batch.NewEntitiesQuery.
func (*Map4[A, B, C, D]) NewEntitiesWith ¶ added in v0.6.0
NewEntitiesWith creates entities with the Map4's components, using the supplied values.
See also Map4.NewEntitiesWithQuery and ecs.Batch.NewEntitiesWith.
func (*Map4[A, B, C, D]) NewEntitiesWithQuery ¶ added in v0.6.0
func (m *Map4[A, B, C, D]) NewEntitiesWithQuery(count int, a *A, b *B, c *C, d *D) Query4[A, B, C, D]
NewEntitiesWithQuery creates entities with the Map4's components, using the supplied values. It returns a Query4 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map4.NewEntitiesWith and ecs.Batch.NewEntitiesWithQuery.
func (*Map4[A, B, C, D]) NewEntity ¶
NewEntity creates a new ecs.Entity with the Map4's components.
See also ecs.World.NewEntity.
func (*Map4[A, B, C, D]) NewEntityWith ¶
NewEntityWith creates a new ecs.Entity with the Map4's components, using the supplied values.
See also ecs.World.NewEntityWith.
func (*Map4[A, B, C, D]) Remove ¶
Remove the Map4's components from the given entity.
See also ecs.World.Remove.
func (*Map4[A, B, C, D]) RemoveEntities ¶ added in v0.6.0
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.World.NewEntityWith.
type Map5 ¶
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 (*Map5[A, B, C, D, E]) Add ¶
Add the Map5's components to the given entity.
See also ecs.World.Add.
func (*Map5[A, B, C, D, E]) Assign ¶
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 ¶
Get all the Map5's components for the given entity.
See also ecs.World.Get.
func (*Map5[A, B, C, D, E]) NewEntities ¶ added in v0.6.0
NewEntities creates entities with the Map5's components.
See also Map5.NewEntitiesQuery and ecs.Batch.NewEntities.
func (*Map5[A, B, C, D, E]) NewEntitiesQuery ¶ added in v0.6.0
NewEntities creates entities with the Map5's components. It returns a Query5 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map5.NewEntities and ecs.Batch.NewEntitiesQuery.
func (*Map5[A, B, C, D, E]) NewEntitiesWith ¶ added in v0.6.0
NewEntitiesWith creates entities with the Map5's components, using the supplied values.
See also Map5.NewEntitiesWithQuery and ecs.Batch.NewEntitiesWith.
func (*Map5[A, B, C, D, E]) NewEntitiesWithQuery ¶ added in v0.6.0
func (m *Map5[A, B, C, D, E]) NewEntitiesWithQuery(count int, a *A, b *B, c *C, d *D, e *E) Query5[A, B, C, D, E]
NewEntitiesWithQuery creates entities with the Map5's components, using the supplied values. It returns a Query5 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map5.NewEntitiesWith and ecs.Batch.NewEntitiesWithQuery.
func (*Map5[A, B, C, D, E]) NewEntity ¶
NewEntity creates a new ecs.Entity with the Map5's components.
See also ecs.World.NewEntity.
func (*Map5[A, B, C, D, E]) NewEntityWith ¶
NewEntityWith creates a new ecs.Entity with the Map5's components, using the supplied values.
See also ecs.World.NewEntityWith.
func (*Map5[A, B, C, D, E]) Remove ¶
Remove the Map5's components from the given entity.
See also ecs.World.Remove.
func (*Map5[A, B, C, D, E]) RemoveEntities ¶ added in v0.6.0
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.World.NewEntityWith.
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 (*Map6[A, B, C, D, E, F]) Add ¶
Add the Map6's components to the given entity.
See also ecs.World.Add.
func (*Map6[A, B, C, D, E, F]) Assign ¶
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 ¶
Get all the Map6's components for the given entity.
See also ecs.World.Get.
func (*Map6[A, B, C, D, E, F]) NewEntities ¶ added in v0.6.0
NewEntities creates entities with the Map6's components.
See also Map6.NewEntitiesQuery and ecs.Batch.NewEntities.
func (*Map6[A, B, C, D, E, F]) NewEntitiesQuery ¶ added in v0.6.0
NewEntities creates entities with the Map6's components. It returns a Query6 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map6.NewEntities and ecs.Batch.NewEntitiesQuery.
func (*Map6[A, B, C, D, E, F]) NewEntitiesWith ¶ added in v0.6.0
NewEntitiesWith creates entities with the Map6's components, using the supplied values.
See also Map6.NewEntitiesWithQuery and ecs.Batch.NewEntitiesWith.
func (*Map6[A, B, C, D, E, F]) NewEntitiesWithQuery ¶ added in v0.6.0
func (m *Map6[A, B, C, D, E, F]) NewEntitiesWithQuery(count int, a *A, b *B, c *C, d *D, e *E, f *F) Query6[A, B, C, D, E, F]
NewEntitiesWithQuery creates entities with the Map6's components, using the supplied values. It returns a Query6 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map6.NewEntitiesWith and ecs.Batch.NewEntitiesWithQuery.
func (*Map6[A, B, C, D, E, F]) NewEntity ¶
NewEntity creates a new ecs.Entity with the Map6's components.
See also ecs.World.NewEntity.
func (*Map6[A, B, C, D, E, F]) NewEntityWith ¶
NewEntityWith creates a new ecs.Entity with the Map6's components, using the supplied values.
See also ecs.World.NewEntityWith.
func (*Map6[A, B, C, D, E, F]) Remove ¶
Remove the Map6's components from the given entity.
See also ecs.World.Remove.
func (*Map6[A, B, C, D, E, F]) RemoveEntities ¶ added in v0.6.0
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.World.NewEntityWith.
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) Map7[A, B, C, D, E, F, G]
NewMap7 creates a new Map7 object.
func (*Map7[A, B, C, D, E, F, G]) Add ¶
Add the Map7's components to the given entity.
See also ecs.World.Add.
func (*Map7[A, B, C, D, E, F, G]) Assign ¶
func (m *Map7[A, B, C, D, E, F, G]) Assign(entity ecs.Entity, a *A, b *B, c *C, d *D, e *E, f *F, g *G)
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 ¶
Get all the Map7's components for the given entity.
See also ecs.World.Get.
func (*Map7[A, B, C, D, E, F, G]) NewEntities ¶ added in v0.6.0
NewEntities creates entities with the Map7's components.
See also Map7.NewEntitiesQuery and ecs.Batch.NewEntities.
func (*Map7[A, B, C, D, E, F, G]) NewEntitiesQuery ¶ added in v0.6.0
NewEntities creates entities with the Map7's components. It returns a Query7 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map7.NewEntities and ecs.Batch.NewEntitiesQuery.
func (*Map7[A, B, C, D, E, F, G]) NewEntitiesWith ¶ added in v0.6.0
func (m *Map7[A, B, C, D, E, F, G]) NewEntitiesWith(count int, a *A, b *B, c *C, d *D, e *E, f *F, g *G)
NewEntitiesWith creates entities with the Map7's components, using the supplied values.
See also Map7.NewEntitiesWithQuery and ecs.Batch.NewEntitiesWith.
func (*Map7[A, B, C, D, E, F, G]) NewEntitiesWithQuery ¶ added in v0.6.0
func (m *Map7[A, B, C, D, E, F, G]) NewEntitiesWithQuery(count int, a *A, b *B, c *C, d *D, e *E, f *F, g *G) Query7[A, B, C, D, E, F, G]
NewEntitiesWithQuery creates entities with the Map7's components, using the supplied values. It returns a Query7 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map7.NewEntitiesWith and ecs.Batch.NewEntitiesWithQuery.
func (*Map7[A, B, C, D, E, F, G]) NewEntity ¶
NewEntity creates a new ecs.Entity with the Map7's components.
See also ecs.World.NewEntity.
func (*Map7[A, B, C, D, E, F, G]) NewEntityWith ¶
func (m *Map7[A, B, C, D, E, F, G]) NewEntityWith(a *A, b *B, c *C, d *D, e *E, f *F, g *G) ecs.Entity
NewEntityWith creates a new ecs.Entity with the Map7's components, using the supplied values.
See also ecs.World.NewEntityWith.
func (*Map7[A, B, C, D, E, F, G]) Remove ¶
Remove the Map7's components from the given entity.
See also ecs.World.Remove.
func (*Map7[A, B, C, D, E, F, G]) RemoveEntities ¶ added in v0.6.0
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.World.NewEntityWith.
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) Map8[A, B, C, D, E, F, G, H]
NewMap8 creates a new Map8 object.
func (*Map8[A, B, C, D, E, F, G, H]) Add ¶
Add the Map8's components to the given entity.
See also ecs.World.Add.
func (*Map8[A, B, C, D, E, F, G, H]) Assign ¶
func (m *Map8[A, B, C, D, E, F, G, H]) Assign(entity ecs.Entity, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H)
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 ¶
Get all the Map8's components for the given entity.
See also ecs.World.Get.
func (*Map8[A, B, C, D, E, F, G, H]) NewEntities ¶ added in v0.6.0
NewEntities creates entities with the Map8's components.
See also Map8.NewEntitiesQuery and ecs.Batch.NewEntities.
func (*Map8[A, B, C, D, E, F, G, H]) NewEntitiesQuery ¶ added in v0.6.0
NewEntities creates entities with the Map8's components. It returns a Query8 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map8.NewEntities and ecs.Batch.NewEntitiesQuery.
func (*Map8[A, B, C, D, E, F, G, H]) NewEntitiesWith ¶ added in v0.6.0
func (m *Map8[A, B, C, D, E, F, G, H]) NewEntitiesWith(count int, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H)
NewEntitiesWith creates entities with the Map8's components, using the supplied values.
See also Map8.NewEntitiesWithQuery and ecs.Batch.NewEntitiesWith.
func (*Map8[A, B, C, D, E, F, G, H]) NewEntitiesWithQuery ¶ added in v0.6.0
func (m *Map8[A, B, C, D, E, F, G, H]) NewEntitiesWithQuery(count int, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H) Query8[A, B, C, D, E, F, G, H]
NewEntitiesWithQuery creates entities with the Map8's components, using the supplied values. It returns a Query8 over the new entities.
Listener notification is delayed until the query is closed of fully iterated.
See also Map8.NewEntitiesWith and ecs.Batch.NewEntitiesWithQuery.
func (*Map8[A, B, C, D, E, F, G, H]) NewEntity ¶
NewEntity creates a new ecs.Entity with the Map8's components.
See also ecs.World.NewEntity.
func (*Map8[A, B, C, D, E, F, G, H]) NewEntityWith ¶
func (m *Map8[A, B, C, D, E, F, G, H]) NewEntityWith(a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H) ecs.Entity
NewEntityWith creates a new ecs.Entity with the Map8's components, using the supplied values.
See also ecs.World.NewEntityWith.
func (*Map8[A, B, C, D, E, F, G, H]) Remove ¶
Remove the Map8's components from the given entity.
See also ecs.World.Remove.
func (*Map8[A, B, C, D, E, F, G, H]) RemoveEntities ¶ added in v0.6.0
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.World.NewEntityWith.
type Query0 ¶
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() }
type Query1 ¶
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.
type Query2 ¶
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.
type Query3 ¶
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.
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.
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.
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.
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.
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.
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
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
Has returns whether the world has the resource type.
See also ecs.Resources.Has.
func (*Resource[T]) ID ¶ added in v0.5.0
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.