Documentation
¶
Index ¶
- Variables
- func C[T any](val T) box[T]
- func CmdSpawn[T Writer](c *CommandQueue, ub T)
- func Comp[T any](t T) comp[T]
- func Delete(world *World, id Id) bool
- func DeleteComponent(world *World, id Id, comp ...Component)
- func GetInjectable[T any](world *World) T
- func GetResource[T any](world *World) *T
- func NewComp[T any]() comp[T]
- func Optional(comps ...any) optional
- func PutResource[T any](world *World, resource *T)
- func Read[T any](world *World, id Id) (T, bool)
- func ReadComp[T Component](e EntityCommand) (T, bool)
- func ReadFromEntity[T any](ent *Entity) (T, bool)
- func ReadPtr[T any](world *World, id Id) *T
- func With(comps ...any) with
- func Without(comps ...any) without
- func Write(world *World, id Id, comp ...Component)
- type Bundler
- type CmdType
- type CommandQueue
- type CompId
- type Component
- type Entity
- type EntityCommand
- type Filter
- type Id
- type Initializer
- type RawEntity
- type Scheduler
- func (s *Scheduler) AppendInput(systems ...System)
- func (s *Scheduler) AppendPhysics(systems ...System)
- func (s *Scheduler) AppendRender(systems ...System)
- func (s *Scheduler) GetRenderInterp() float64
- func (s *Scheduler) PauseRender(value bool)
- func (s *Scheduler) Quit() bool
- func (s *Scheduler) Run()
- func (s *Scheduler) SetFixedTimeStep(t time.Duration)
- func (s *Scheduler) SetGameSpeed(speed float64)
- func (s *Scheduler) SetInput(systems ...System)
- func (s *Scheduler) SetMaxPhysicsLoopCount(count int)
- func (s *Scheduler) SetPhysics(systems ...System)
- func (s *Scheduler) SetQuit(value bool)
- func (s *Scheduler) SetRender(systems ...System)
- func (s *Scheduler) Syslog() []SystemLog
- func (s *Scheduler) SyslogFixed() []SystemLog
- type System
- func NewSystem(lambda func(dt time.Duration)) System
- func NewSystem1[A Initializer](world *World, lambda func(dt time.Duration, a A)) System
- func NewSystem2[A, B Initializer](world *World, lambda func(dt time.Duration, a A, b B)) System
- func NewSystem3[A, B, C Initializer](world *World, lambda func(dt time.Duration, a A, b B, c C)) System
- func NewSystem4[A, B, C, D Initializer](world *World, lambda func(dt time.Duration, a A, b B, c C, d D)) System
- type SystemLog
- type View1
- type View10
- func (v *View10[A, B, C, D, E, F, G, H, I, J]) Count() int
- func (v *View10[A, B, C, D, E, F, G, H, I, J]) MapId(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I, j *J))
- func (v *View10[A, B, C, D, E, F, G, H, I, J]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I, j *J))
- func (v *View10[A, B, C, D, E, F, G, H, I, J]) MapSlices(...)deprecated
- func (v *View10[A, B, C, D, E, F, G, H, I, J]) Read(id Id) (*A, *B, *C, *D, *E, *F, *G, *H, *I, *J)
- type View11
- func (v *View11[A, B, C, D, E, F, G, H, I, J, K]) Count() int
- func (v *View11[A, B, C, D, E, F, G, H, I, J, K]) MapId(...)
- func (v *View11[A, B, C, D, E, F, G, H, I, J, K]) MapIdParallel(...)
- func (v *View11[A, B, C, D, E, F, G, H, I, J, K]) MapSlices(...)deprecated
- func (v *View11[A, B, C, D, E, F, G, H, I, J, K]) Read(id Id) (*A, *B, *C, *D, *E, *F, *G, *H, *I, *J, *K)
- type View12
- func (v *View12[A, B, C, D, E, F, G, H, I, J, K, L]) Count() int
- func (v *View12[A, B, C, D, E, F, G, H, I, J, K, L]) MapId(...)
- func (v *View12[A, B, C, D, E, F, G, H, I, J, K, L]) MapIdParallel(...)
- func (v *View12[A, B, C, D, E, F, G, H, I, J, K, L]) MapSlices(...)deprecated
- func (v *View12[A, B, C, D, E, F, G, H, I, J, K, L]) Read(id Id) (*A, *B, *C, *D, *E, *F, *G, *H, *I, *J, *K, *L)
- type View2
- type View3
- func (v *View3[A, B, C]) Count() int
- func (v *View3[A, B, C]) MapId(lambda func(id Id, a *A, b *B, c *C))
- func (v *View3[A, B, C]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C))
- func (v *View3[A, B, C]) MapSlices(lambda func(id []Id, a []A, b []B, c []C))deprecated
- func (v *View3[A, B, C]) Read(id Id) (*A, *B, *C)
- type View4
- func (v *View4[A, B, C, D]) Count() int
- func (v *View4[A, B, C, D]) MapId(lambda func(id Id, a *A, b *B, c *C, d *D))
- func (v *View4[A, B, C, D]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C, d *D))
- func (v *View4[A, B, C, D]) MapSlices(lambda func(id []Id, a []A, b []B, c []C, d []D))deprecated
- func (v *View4[A, B, C, D]) Read(id Id) (*A, *B, *C, *D)
- type View5
- func (v *View5[A, B, C, D, E]) Count() int
- func (v *View5[A, B, C, D, E]) MapId(lambda func(id Id, a *A, b *B, c *C, d *D, e *E))
- func (v *View5[A, B, C, D, E]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C, d *D, e *E))
- func (v *View5[A, B, C, D, E]) MapSlices(lambda func(id []Id, a []A, b []B, c []C, d []D, e []E))deprecated
- func (v *View5[A, B, C, D, E]) Read(id Id) (*A, *B, *C, *D, *E)
- type View6
- func (v *View6[A, B, C, D, E, F]) Count() int
- func (v *View6[A, B, C, D, E, F]) MapId(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F))
- func (v *View6[A, B, C, D, E, F]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F))
- func (v *View6[A, B, C, D, E, F]) MapSlices(lambda func(id []Id, a []A, b []B, c []C, d []D, e []E, f []F))deprecated
- func (v *View6[A, B, C, D, E, F]) Read(id Id) (*A, *B, *C, *D, *E, *F)
- type View7
- func (v *View7[A, B, C, D, E, F, G]) Count() int
- func (v *View7[A, B, C, D, E, F, G]) MapId(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G))
- func (v *View7[A, B, C, D, E, F, G]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G))
- func (v *View7[A, B, C, D, E, F, G]) MapSlices(lambda func(id []Id, a []A, b []B, c []C, d []D, e []E, f []F, g []G))deprecated
- func (v *View7[A, B, C, D, E, F, G]) Read(id Id) (*A, *B, *C, *D, *E, *F, *G)
- type View8
- func (v *View8[A, B, C, D, E, F, G, H]) Count() int
- func (v *View8[A, B, C, D, E, F, G, H]) MapId(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H))
- func (v *View8[A, B, C, D, E, F, G, H]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H))
- func (v *View8[A, B, C, D, E, F, G, H]) MapSlices(lambda func(id []Id, a []A, b []B, c []C, d []D, e []E, f []F, g []G, h []H))deprecated
- func (v *View8[A, B, C, D, E, F, G, H]) Read(id Id) (*A, *B, *C, *D, *E, *F, *G, *H)
- type View9
- func (v *View9[A, B, C, D, E, F, G, H, I]) Count() int
- func (v *View9[A, B, C, D, E, F, G, H, I]) MapId(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I))
- func (v *View9[A, B, C, D, E, F, G, H, I]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I))
- func (v *View9[A, B, C, D, E, F, G, H, I]) MapSlices(...)deprecated
- func (v *View9[A, B, C, D, E, F, G, H, I]) Read(id Id) (*A, *B, *C, *D, *E, *F, *G, *H, *I)
- type W
- type World
- type Writer
Constants ¶
This section is empty.
Variables ¶
var (
DefaultAllocation = 0
)
Functions ¶
func CmdSpawn ¶ added in v0.0.2
func CmdSpawn[T Writer](c *CommandQueue, ub T)
func Delete ¶
Deletes the entire entity specified by the id This can be called inside maps and loops, it will delete the entity immediately. Returns true if the entity exists and was actually deleted, else returns false
func DeleteComponent ¶ added in v0.0.2
Deletes specific components from an entity in the world Skips all work if the entity doesn't exist Skips deleting components that the entity doesn't have If no components remain after the delete, the entity will be completely removed
func GetInjectable ¶ added in v0.0.2
func GetResource ¶
func Optional ¶
func Optional(comps ...any) optional
Creates a filter to make the query still iterate even if a specific component is missing, in which case you'll get nil if the component isn't there when accessed
func PutResource ¶
TODO: Should I force people to do pointers?
func Read ¶
Reads a specific component of the entity specified at id. Returns true if the entity was found and had that component, else returns false. Deprecated: This API is tentative, I'm trying to improve the QueryN construct so that it can capture this usecase.
func ReadComp ¶ added in v0.0.2
func ReadComp[T Component](e EntityCommand) (T, bool)
func (e EntityCommand) Add(seq iter.Seq[Component]) EntityCommand { for c := range seq { e.cmd.bundler.Add(c) } return e }
func ReadFromEntity ¶
Reads a specific component from the entity, returns false if the component doesn't exist
func ReadPtr ¶
Reads a pointer to the component of the entity at the specified id. Returns true if the entity was found and had that component, else returns false. This pointer is short lived and can become invalid if any other entity changes in the world Deprecated: This API is tentative, I'm trying to improve the QueryN construct so that it can capture this usecase.
func With ¶
func With(comps ...any) with
Creates a filter to ensure that entities have the specified components
func Without ¶ added in v0.0.1
func Without(comps ...any) without
Creates a filter to ensure that entities will not have the specified components
func Write ¶
Writes components to the entity specified at id. This API can potentially break if you call it inside of a loop. Specifically, if you cause the archetype of the entity to change by writing a new component, then the loop may act in mysterious ways. Deprecated: This API is tentative, I might replace it with something similar to bevy commands to alleviate the above concern
Types ¶
type Bundler ¶ added in v0.0.2
type CommandQueue ¶ added in v0.0.2
type CommandQueue struct {
// contains filtered or unexported fields
}
func NewCommandQueue ¶ added in v0.0.2
func NewCommandQueue(world *World) *CommandQueue
func (*CommandQueue) Execute ¶ added in v0.0.2
func (c *CommandQueue) Execute()
func (*CommandQueue) NextBundler ¶ added in v0.0.2
func (c *CommandQueue) NextBundler() *Bundler
func (*CommandQueue) Spawn ¶ added in v0.0.2
func (c *CommandQueue) Spawn(bun Writer)
func (*CommandQueue) SpawnEmpty ¶ added in v0.0.2
func (c *CommandQueue) SpawnEmpty() EntityCommand
func (*CommandQueue) Write ¶ added in v0.0.3
func (c *CommandQueue) Write(id Id) EntityCommand
type Entity ¶
type Entity struct {
// contains filtered or unexported fields
}
An Entity is essentially a map of components that is held external to a world. Useful for pulling full entities in and out of the world. Deprecated: This type and its corresponding methods are tentative and might be replaced by something else.
func ReadEntity ¶
Reads the entire entity out of the world and into an *Entity object. Returns nil if the entity doesn't exist
type EntityCommand ¶ added in v0.0.2
type EntityCommand struct {
// contains filtered or unexported fields
}
func (EntityCommand) Cancel ¶ added in v0.0.3
func (e EntityCommand) Cancel()
func (EntityCommand) Empty ¶ added in v0.0.2
func (e EntityCommand) Empty() bool
func (EntityCommand) Id ¶ added in v0.0.2
func (e EntityCommand) Id() Id
func (EntityCommand) Insert ¶ added in v0.0.2
func (e EntityCommand) Insert(bun Writer) EntityCommand
func (EntityCommand) Printout ¶ added in v0.0.2
func (e EntityCommand) Printout()
type Filter ¶
Optional - Lets you view even if component is missing (func will return nil) With - Lets you add additional components that must be present Without - Lets you add additional components that must not be present
type Initializer ¶ added in v0.0.2
type Initializer interface {
// contains filtered or unexported methods
}
type RawEntity ¶
type RawEntity struct {
// contains filtered or unexported fields
}
A RawEntity is like an Entity, but every component is actually a pointer to the underlying component. I mostly use this to build inspector UIs that can directly modify an entity Deprecated: This type and its corresponding methods are tentative and might be replaced by something else.
func NewRawEntity ¶
Creates a new entity with the specified components
func ReadRawEntity ¶
Reads the entire entity out of the world and into an *RawEntity object. Returns nil if the entity doesn't exist. RawEntity is lik
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler is a place to put your systems and have them run. There are two types of systems: Fixed time systems and dynamic time systems 1. Fixed time systems will execute on a fixed time step 2. Dynamic time systems will execute as quickly as they possibly can The scheduler may change in the future, but right now how it works is simple: Input: Execute input systems (Dynamic time systems) Physics: Execute physics systems (Fixed time systems) Render: Execute render systems (Dynamic time systems)
func (*Scheduler) AppendInput ¶
Adds a system to the list of input systems
func (*Scheduler) AppendPhysics ¶
Adds a system to the list of physics systems
func (*Scheduler) AppendRender ¶
Adds a system to the list of render systems
func (*Scheduler) GetRenderInterp ¶
Returns an interpolation value which represents how close we are to the next fixed time step execution. Can be useful for interpolating dynamic time systems to the fixed time systems. I might rename this
func (*Scheduler) PauseRender ¶
Pauses the set of render systems (ie they will be skipped). Deprecated: This API is tentatitive
func (*Scheduler) Run ¶
func (s *Scheduler) Run()
Note: Would be nice to sleep or something to prevent spinning while we wait for work to do Could also separate the render loop from the physics loop (requires some thread safety in ECS)
func (*Scheduler) SetFixedTimeStep ¶
Sets the amount of time required before the fixed time systems will execute
func (*Scheduler) SetGameSpeed ¶ added in v0.0.2
Sets the rate at which time accumulates. Also, you want them to only change at the end of a frame, else you might get some inconsistencies. Just use a mutex and a single temporary variable
func (*Scheduler) SetMaxPhysicsLoopCount ¶
Sets the accumulator maximum point so that if the accumulator gets way to big, we will reset it and continue on, dropping all physics ticks that would have been executed. This is useful in a runtime like WASM where the browser may not let us run as frequently as we may need (for example, when the tab is hidden or minimized). Note: This must be set before you call scheduler.Run() Note: The default value is 0, which will force every physics tick to run. I highly recommend setting this to something if you plan to build for WASM!
func (*Scheduler) SetPhysics ¶ added in v0.0.2
Adds a system to the list of physics systems
func (*Scheduler) SetQuit ¶
Tells the scheduler to exit. Scheduler will finish executing its remaining tick before closing.
func (*Scheduler) Syslog ¶
Returns the front syslog so the user can analyze it. Note: This is only valid for the current frame, you should call this every frame if you use it!
func (*Scheduler) SyslogFixed ¶
Returns the front syslog for fixed-dt systems only. Note: This is only valid for the current frame, you should call this every frame if you use it!
type System ¶
Represents an individual system
func NewSystem ¶
Create a new system. The system name will be automatically created based on the function name that calls this function
func NewSystem1 ¶ added in v0.0.2
func NewSystem1[A Initializer](world *World, lambda func(dt time.Duration, a A)) System
func NewSystem2 ¶ added in v0.0.2
func NewSystem2[A, B Initializer](world *World, lambda func(dt time.Duration, a A, b B)) System
func NewSystem3 ¶ added in v0.0.2
func NewSystem3[A, B, C Initializer](world *World, lambda func(dt time.Duration, a A, b B, c C)) System
func NewSystem4 ¶ added in v0.0.2
func NewSystem4[A, B, C, D Initializer](world *World, lambda func(dt time.Duration, a A, b B, c C, d D)) System
type View1 ¶
type View1[A any] struct { // contains filtered or unexported fields }
Represents a view of data in a specific world. Provides access to the components specified in the generic block
func (*View1[A]) MapId ¶
Maps the lambda function across every entity which matched the specified filters.
func (*View1[A]) MapIdParallel ¶ added in v0.0.2
Maps the lambda function across every entity which matched the specified filters. Components are split based on the number of OS threads available.
func (*View1[A]) Read ¶
Reads a pointer to the underlying component at the specified id. Read will return even if the specified id doesn't match the filter list Read will return the value if it exists, else returns nil. If you execute any ecs.Write(...) or ecs.Delete(...) this pointer may become invalid.
type View10 ¶
type View10[A, B, C, D, E, F, G, H, I, J any] struct { // contains filtered or unexported fields }
Represents a view of data in a specific world. Provides access to the components specified in the generic block
func Query10 ¶
func Query10[A, B, C, D, E, F, G, H, I, J any](world *World, filters ...Filter) *View10[A, B, C, D, E, F, G, H, I, J]
Creates a View for the specified world with the specified component filters.
func (*View10[A, B, C, D, E, F, G, H, I, J]) Count ¶ added in v0.0.2
Counts the number of entities that match this query
func (*View10[A, B, C, D, E, F, G, H, I, J]) MapId ¶
func (v *View10[A, B, C, D, E, F, G, H, I, J]) MapId(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I, j *J))
Maps the lambda function across every entity which matched the specified filters.
func (*View10[A, B, C, D, E, F, G, H, I, J]) MapIdParallel ¶ added in v0.0.2
func (v *View10[A, B, C, D, E, F, G, H, I, J]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I, j *J))
Maps the lambda function across every entity which matched the specified filters. Components are split based on the number of OS threads available.
func (*View10[A, B, C, D, E, F, G, H, I, J]) Read ¶
Reads a pointer to the underlying component at the specified id. Read will return even if the specified id doesn't match the filter list Read will return the value if it exists, else returns nil. If you execute any ecs.Write(...) or ecs.Delete(...) this pointer may become invalid.
type View11 ¶
type View11[A, B, C, D, E, F, G, H, I, J, K any] struct { // contains filtered or unexported fields }
Represents a view of data in a specific world. Provides access to the components specified in the generic block
func Query11 ¶
func Query11[A, B, C, D, E, F, G, H, I, J, K any](world *World, filters ...Filter) *View11[A, B, C, D, E, F, G, H, I, J, K]
Creates a View for the specified world with the specified component filters.
func (*View11[A, B, C, D, E, F, G, H, I, J, K]) Count ¶ added in v0.0.2
Counts the number of entities that match this query
func (*View11[A, B, C, D, E, F, G, H, I, J, K]) MapId ¶
func (v *View11[A, B, C, D, E, F, G, H, I, J, K]) MapId(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I, j *J, k *K))
Maps the lambda function across every entity which matched the specified filters.
func (*View11[A, B, C, D, E, F, G, H, I, J, K]) MapIdParallel ¶ added in v0.0.2
func (v *View11[A, B, C, D, E, F, G, H, I, J, K]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I, j *J, k *K))
Maps the lambda function across every entity which matched the specified filters. Components are split based on the number of OS threads available.
func (*View11[A, B, C, D, E, F, G, H, I, J, K]) Read ¶
func (v *View11[A, B, C, D, E, F, G, H, I, J, K]) Read(id Id) (*A, *B, *C, *D, *E, *F, *G, *H, *I, *J, *K)
Reads a pointer to the underlying component at the specified id. Read will return even if the specified id doesn't match the filter list Read will return the value if it exists, else returns nil. If you execute any ecs.Write(...) or ecs.Delete(...) this pointer may become invalid.
type View12 ¶
type View12[A, B, C, D, E, F, G, H, I, J, K, L any] struct { // contains filtered or unexported fields }
Represents a view of data in a specific world. Provides access to the components specified in the generic block
func Query12 ¶
func Query12[A, B, C, D, E, F, G, H, I, J, K, L any](world *World, filters ...Filter) *View12[A, B, C, D, E, F, G, H, I, J, K, L]
Creates a View for the specified world with the specified component filters.
func (*View12[A, B, C, D, E, F, G, H, I, J, K, L]) Count ¶ added in v0.0.2
Counts the number of entities that match this query
func (*View12[A, B, C, D, E, F, G, H, I, J, K, L]) MapId ¶
func (v *View12[A, B, C, D, E, F, G, H, I, J, K, L]) MapId(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I, j *J, k *K, l *L))
Maps the lambda function across every entity which matched the specified filters.
func (*View12[A, B, C, D, E, F, G, H, I, J, K, L]) MapIdParallel ¶ added in v0.0.2
func (v *View12[A, B, C, D, E, F, G, H, I, J, K, L]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I, j *J, k *K, l *L))
Maps the lambda function across every entity which matched the specified filters. Components are split based on the number of OS threads available.
func (*View12[A, B, C, D, E, F, G, H, I, J, K, L]) Read ¶
func (v *View12[A, B, C, D, E, F, G, H, I, J, K, L]) Read(id Id) (*A, *B, *C, *D, *E, *F, *G, *H, *I, *J, *K, *L)
Reads a pointer to the underlying component at the specified id. Read will return even if the specified id doesn't match the filter list Read will return the value if it exists, else returns nil. If you execute any ecs.Write(...) or ecs.Delete(...) this pointer may become invalid.
type View2 ¶
type View2[A, B any] struct { // contains filtered or unexported fields }
Represents a view of data in a specific world. Provides access to the components specified in the generic block
func (*View2[A, B]) MapId ¶
Maps the lambda function across every entity which matched the specified filters.
func (*View2[A, B]) MapIdParallel ¶ added in v0.0.2
Maps the lambda function across every entity which matched the specified filters. Components are split based on the number of OS threads available.
func (*View2[A, B]) Read ¶
Reads a pointer to the underlying component at the specified id. Read will return even if the specified id doesn't match the filter list Read will return the value if it exists, else returns nil. If you execute any ecs.Write(...) or ecs.Delete(...) this pointer may become invalid.
type View3 ¶
type View3[A, B, C any] struct { // contains filtered or unexported fields }
Represents a view of data in a specific world. Provides access to the components specified in the generic block
func (*View3[A, B, C]) MapId ¶
Maps the lambda function across every entity which matched the specified filters.
func (*View3[A, B, C]) MapIdParallel ¶ added in v0.0.2
Maps the lambda function across every entity which matched the specified filters. Components are split based on the number of OS threads available.
func (*View3[A, B, C]) Read ¶
Reads a pointer to the underlying component at the specified id. Read will return even if the specified id doesn't match the filter list Read will return the value if it exists, else returns nil. If you execute any ecs.Write(...) or ecs.Delete(...) this pointer may become invalid.
type View4 ¶
type View4[A, B, C, D any] struct { // contains filtered or unexported fields }
Represents a view of data in a specific world. Provides access to the components specified in the generic block
func (*View4[A, B, C, D]) Count ¶ added in v0.0.2
Counts the number of entities that match this query
func (*View4[A, B, C, D]) MapId ¶
Maps the lambda function across every entity which matched the specified filters.
func (*View4[A, B, C, D]) MapIdParallel ¶ added in v0.0.2
Maps the lambda function across every entity which matched the specified filters. Components are split based on the number of OS threads available.
func (*View4[A, B, C, D]) Read ¶
Reads a pointer to the underlying component at the specified id. Read will return even if the specified id doesn't match the filter list Read will return the value if it exists, else returns nil. If you execute any ecs.Write(...) or ecs.Delete(...) this pointer may become invalid.
type View5 ¶
type View5[A, B, C, D, E any] struct { // contains filtered or unexported fields }
Represents a view of data in a specific world. Provides access to the components specified in the generic block
func (*View5[A, B, C, D, E]) Count ¶ added in v0.0.2
Counts the number of entities that match this query
func (*View5[A, B, C, D, E]) MapId ¶
Maps the lambda function across every entity which matched the specified filters.
func (*View5[A, B, C, D, E]) MapIdParallel ¶ added in v0.0.2
Maps the lambda function across every entity which matched the specified filters. Components are split based on the number of OS threads available.
func (*View5[A, B, C, D, E]) Read ¶
Reads a pointer to the underlying component at the specified id. Read will return even if the specified id doesn't match the filter list Read will return the value if it exists, else returns nil. If you execute any ecs.Write(...) or ecs.Delete(...) this pointer may become invalid.
type View6 ¶
type View6[A, B, C, D, E, F any] struct { // contains filtered or unexported fields }
Represents a view of data in a specific world. Provides access to the components specified in the generic block
func (*View6[A, B, C, D, E, F]) Count ¶ added in v0.0.2
Counts the number of entities that match this query
func (*View6[A, B, C, D, E, F]) MapId ¶
Maps the lambda function across every entity which matched the specified filters.
func (*View6[A, B, C, D, E, F]) MapIdParallel ¶ added in v0.0.2
func (v *View6[A, B, C, D, E, F]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F))
Maps the lambda function across every entity which matched the specified filters. Components are split based on the number of OS threads available.
func (*View6[A, B, C, D, E, F]) Read ¶
Reads a pointer to the underlying component at the specified id. Read will return even if the specified id doesn't match the filter list Read will return the value if it exists, else returns nil. If you execute any ecs.Write(...) or ecs.Delete(...) this pointer may become invalid.
type View7 ¶
type View7[A, B, C, D, E, F, G any] struct { // contains filtered or unexported fields }
Represents a view of data in a specific world. Provides access to the components specified in the generic block
func (*View7[A, B, C, D, E, F, G]) Count ¶ added in v0.0.2
Counts the number of entities that match this query
func (*View7[A, B, C, D, E, F, G]) MapId ¶
func (v *View7[A, B, C, D, E, F, G]) MapId(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G))
Maps the lambda function across every entity which matched the specified filters.
func (*View7[A, B, C, D, E, F, G]) MapIdParallel ¶ added in v0.0.2
func (v *View7[A, B, C, D, E, F, G]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G))
Maps the lambda function across every entity which matched the specified filters. Components are split based on the number of OS threads available.
func (*View7[A, B, C, D, E, F, G]) Read ¶
Reads a pointer to the underlying component at the specified id. Read will return even if the specified id doesn't match the filter list Read will return the value if it exists, else returns nil. If you execute any ecs.Write(...) or ecs.Delete(...) this pointer may become invalid.
type View8 ¶
type View8[A, B, C, D, E, F, G, H any] struct { // contains filtered or unexported fields }
Represents a view of data in a specific world. Provides access to the components specified in the generic block
func Query8 ¶
func Query8[A, B, C, D, E, F, G, H any](world *World, filters ...Filter) *View8[A, B, C, D, E, F, G, H]
Creates a View for the specified world with the specified component filters.
func (*View8[A, B, C, D, E, F, G, H]) Count ¶ added in v0.0.2
Counts the number of entities that match this query
func (*View8[A, B, C, D, E, F, G, H]) MapId ¶
func (v *View8[A, B, C, D, E, F, G, H]) MapId(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H))
Maps the lambda function across every entity which matched the specified filters.
func (*View8[A, B, C, D, E, F, G, H]) MapIdParallel ¶ added in v0.0.2
func (v *View8[A, B, C, D, E, F, G, H]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H))
Maps the lambda function across every entity which matched the specified filters. Components are split based on the number of OS threads available.
func (*View8[A, B, C, D, E, F, G, H]) Read ¶
Reads a pointer to the underlying component at the specified id. Read will return even if the specified id doesn't match the filter list Read will return the value if it exists, else returns nil. If you execute any ecs.Write(...) or ecs.Delete(...) this pointer may become invalid.
type View9 ¶
type View9[A, B, C, D, E, F, G, H, I any] struct { // contains filtered or unexported fields }
Represents a view of data in a specific world. Provides access to the components specified in the generic block
func Query9 ¶
func Query9[A, B, C, D, E, F, G, H, I any](world *World, filters ...Filter) *View9[A, B, C, D, E, F, G, H, I]
Creates a View for the specified world with the specified component filters.
func (*View9[A, B, C, D, E, F, G, H, I]) Count ¶ added in v0.0.2
Counts the number of entities that match this query
func (*View9[A, B, C, D, E, F, G, H, I]) MapId ¶
func (v *View9[A, B, C, D, E, F, G, H, I]) MapId(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I))
Maps the lambda function across every entity which matched the specified filters.
func (*View9[A, B, C, D, E, F, G, H, I]) MapIdParallel ¶ added in v0.0.2
func (v *View9[A, B, C, D, E, F, G, H, I]) MapIdParallel(lambda func(id Id, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, i *I))
Maps the lambda function across every entity which matched the specified filters. Components are split based on the number of OS threads available.
func (*View9[A, B, C, D, E, F, G, H, I]) Read ¶
Reads a pointer to the underlying component at the specified id. Read will return even if the specified id doesn't match the filter list Read will return the value if it exists, else returns nil. If you execute any ecs.Write(...) or ecs.Delete(...) this pointer may become invalid.
type World ¶
type World struct {
// contains filtered or unexported fields
}
World is the main data-holder. You usually pass it to other functions to do things.
func (*World) NewId ¶
Creates a new Id which can then be used to create an entity. This is threadsafe
func (*World) SetIdRange ¶
Sets an range of Ids that the world will use when creating new Ids. Potentially helpful when you have multiple worlds and don't want their Id space to collide. Deprecated: This API is tentative. It may be better to just have the user create Ids as they see fit