package ecs// Code generated by go generate; DO NOT EDIT.// Observer1 is a generic observer for 1 components.//// See [Observer] for details on events and observers.typeObserver1[ any] struct { observer Observer callback func(Entity, *)}// Observe1 creates a new Observer1.//// See also [Observer1.New] for a shortcut when constructing an already defined instance.func [ any]( EventType) *Observer1[] { := make([]Comp, 0, 6) = append(, comp[]())return &Observer1[]{observer: Observer{event: ,comps: ,observerData: observerData{id: maxObserverID, }, }, }}// New creates a new [Observer1]. It is safe to call on `nil` instance.// It is a helper method, intended to avoid repeated listing of type parameters.func ( *Observer1[]) ( EventType) *Observer1[] {returnObserve1[]()}// For adds further components that the observer observes, in addition to its generic parameters.//// Method calls can be chained, which has the same effect as calling with multiple arguments.func ( *Observer1[]) ( ...Comp) *Observer1[] { .observer.For(...)return}// With adds components that entities must have to trigger the observer.// If multiple components are provided, the entity must have all of them.//// Method calls can be chained, which has the same effect as calling with multiple arguments.func ( *Observer1[]) ( ...Comp) *Observer1[] { .observer.With(...)return}// Without adds components that entities must not have to trigger the observer.// If multiple components are provided, the entity must not have any of them.//// Method calls can be chained, which has the same effect as calling with multiple arguments.func ( *Observer1[]) ( ...Comp) *Observer1[] { .observer.Without(...)return}// Exclusive makes the observer exclusive in the sense that the components given by [Observer.With]// are matched exactly, and no other components are allowed.//// Overwrites components set via [Observer.Without].func ( *Observer1[]) () *Observer1[] { .observer.Exclusive()return}// Do sets the observer's callback. Must be called exactly once before registration.func ( *Observer1[]) ( func(Entity, *)) *Observer1[] {if .callback != nil {panic("observer already has a callback") } .callback = return}// Register this observer. This is mandatory for the observer to take effect.func ( *Observer1[]) ( *World) *Observer1[] {if .callback == nil {panic("observer callback must be set via Do before registering") } := &.storage.components[ComponentID[]().id] .observer.callback = func( Entity) { := &.storage.entities[.id] := uintptr(.row) .callback( , (*)(.columns[.table].Get()), ) } .registerObserver(&.observer)return}// Unregister this observer.func ( *Observer1[]) ( *World) *Observer1[] { .unregisterObserver(&.observer)return}// Observer2 is a generic observer for 2 components.//// See [Observer] for details on events and observers.//// See [Observer1] for an example.typeObserver2[ any, any] struct { observer Observer callback func(Entity, *, *)}// Observe2 creates a new Observer2.//// See also [Observer2.New] for a shortcut when constructing an already defined instance.func [ any, any]( EventType) *Observer2[, ] { := make([]Comp, 0, 6) = append(, comp[]()) = append(, comp[]())return &Observer2[, ]{observer: Observer{event: ,comps: ,observerData: observerData{id: maxObserverID, }, }, }}// New creates a new [Observer2]. It is safe to call on `nil` instance.// It is a helper method, intended to avoid repeated listing of type parameters.//// See [Observer1.New] for an example.func ( *Observer2[, ]) ( EventType) *Observer2[, ] {returnObserve2[, ]()}// For adds further components that the observer observes, in addition to its generic parameters.//// Method calls can be chained, which has the same effect as calling with multiple arguments.//// See [Observer1.For] for an example.func ( *Observer2[, ]) ( ...Comp) *Observer2[, ] { .observer.For(...)return}// With adds components that entities must have to trigger the observer.// If multiple components are provided, the entity must have all of them.//// Method calls can be chained, which has the same effect as calling with multiple arguments.//// See [Observer1.With] for an example.func ( *Observer2[, ]) ( ...Comp) *Observer2[, ] { .observer.With(...)return}// Without adds components that entities must not have to trigger the observer.// If multiple components are provided, the entity must not have any of them.//// Method calls can be chained, which has the same effect as calling with multiple arguments.//// See [Observer1.Without] for an example.func ( *Observer2[, ]) ( ...Comp) *Observer2[, ] { .observer.Without(...)return}// Exclusive makes the observer exclusive in the sense that the components given by [Observer.With]// are matched exactly, and no other components are allowed.//// Overwrites components set via [Observer.Without].//// See [Observer1.Exclusive] for an example.func ( *Observer2[, ]) () *Observer2[, ] { .observer.Exclusive()return}// Do sets the observer's callback. Must be called exactly once before registration.func ( *Observer2[, ]) ( func(Entity, *, *)) *Observer2[, ] {if .callback != nil {panic("observer already has a callback") } .callback = return}// Register this observer. This is mandatory for the observer to take effect.func ( *Observer2[, ]) ( *World) *Observer2[, ] {if .callback == nil {panic("observer callback must be set via Do before registering") } := &.storage.components[ComponentID[]().id] := &.storage.components[ComponentID[]().id] .observer.callback = func( Entity) { := &.storage.entities[.id] := uintptr(.row) .callback( , (*)(.columns[.table].Get()), (*)(.columns[.table].Get()), ) } .registerObserver(&.observer)return}// Unregister this observer.func ( *Observer2[, ]) ( *World) *Observer2[, ] { .unregisterObserver(&.observer)return}// Observer3 is a generic observer for 3 components.//// See [Observer] for details on events and observers.//// See [Observer1] for an example.typeObserver3[ any, any, any] struct { observer Observer callback func(Entity, *, *, *)}// Observe3 creates a new Observer3.//// See also [Observer3.New] for a shortcut when constructing an already defined instance.func [ any, any, any]( EventType) *Observer3[, , ] { := make([]Comp, 0, 6) = append(, comp[]()) = append(, comp[]()) = append(, comp[]())return &Observer3[, , ]{observer: Observer{event: ,comps: ,observerData: observerData{id: maxObserverID, }, }, }}// New creates a new [Observer3]. It is safe to call on `nil` instance.// It is a helper method, intended to avoid repeated listing of type parameters.//// See [Observer1.New] for an example.func ( *Observer3[, , ]) ( EventType) *Observer3[, , ] {returnObserve3[, , ]()}// For adds further components that the observer observes, in addition to its generic parameters.//// Method calls can be chained, which has the same effect as calling with multiple arguments.//// See [Observer1.For] for an example.func ( *Observer3[, , ]) ( ...Comp) *Observer3[, , ] { .observer.For(...)return}// With adds components that entities must have to trigger the observer.// If multiple components are provided, the entity must have all of them.//// Method calls can be chained, which has the same effect as calling with multiple arguments.//// See [Observer1.With] for an example.func ( *Observer3[, , ]) ( ...Comp) *Observer3[, , ] { .observer.With(...)return}// Without adds components that entities must not have to trigger the observer.// If multiple components are provided, the entity must not have any of them.//// Method calls can be chained, which has the same effect as calling with multiple arguments.//// See [Observer1.Without] for an example.func ( *Observer3[, , ]) ( ...Comp) *Observer3[, , ] { .observer.Without(...)return}// Exclusive makes the observer exclusive in the sense that the components given by [Observer.With]// are matched exactly, and no other components are allowed.//// Overwrites components set via [Observer.Without].//// See [Observer1.Exclusive] for an example.func ( *Observer3[, , ]) () *Observer3[, , ] { .observer.Exclusive()return}// Do sets the observer's callback. Must be called exactly once before registration.func ( *Observer3[, , ]) ( func(Entity, *, *, *)) *Observer3[, , ] {if .callback != nil {panic("observer already has a callback") } .callback = return}// Register this observer. This is mandatory for the observer to take effect.func ( *Observer3[, , ]) ( *World) *Observer3[, , ] {if .callback == nil {panic("observer callback must be set via Do before registering") } := &.storage.components[ComponentID[]().id] := &.storage.components[ComponentID[]().id] := &.storage.components[ComponentID[]().id] .observer.callback = func( Entity) { := &.storage.entities[.id] := uintptr(.row) .callback( , (*)(.columns[.table].Get()), (*)(.columns[.table].Get()), (*)(.columns[.table].Get()), ) } .registerObserver(&.observer)return}// Unregister this observer.func ( *Observer3[, , ]) ( *World) *Observer3[, , ] { .unregisterObserver(&.observer)return}// Observer4 is a generic observer for 4 components.//// See [Observer] for details on events and observers.//// See [Observer1] for an example.typeObserver4[ any, any, any, any] struct { observer Observer callback func(Entity, *, *, *, *)}// Observe4 creates a new Observer4.//// See also [Observer4.New] for a shortcut when constructing an already defined instance.func [ any, any, any, any]( EventType) *Observer4[, , , ] { := make([]Comp, 0, 6) = append(, comp[]()) = append(, comp[]()) = append(, comp[]()) = append(, comp[]())return &Observer4[, , , ]{observer: Observer{event: ,comps: ,observerData: observerData{id: maxObserverID, }, }, }}// New creates a new [Observer4]. It is safe to call on `nil` instance.// It is a helper method, intended to avoid repeated listing of type parameters.//// See [Observer1.New] for an example.func ( *Observer4[, , , ]) ( EventType) *Observer4[, , , ] {returnObserve4[, , , ]()}// For adds further components that the observer observes, in addition to its generic parameters.//// Method calls can be chained, which has the same effect as calling with multiple arguments.//// See [Observer1.For] for an example.func ( *Observer4[, , , ]) ( ...Comp) *Observer4[, , , ] { .observer.For(...)return}// With adds components that entities must have to trigger the observer.// If multiple components are provided, the entity must have all of them.//// Method calls can be chained, which has the same effect as calling with multiple arguments.//// See [Observer1.With] for an example.func ( *Observer4[, , , ]) ( ...Comp) *Observer4[, , , ] { .observer.With(...)return}// Without adds components that entities must not have to trigger the observer.// If multiple components are provided, the entity must not have any of them.//// Method calls can be chained, which has the same effect as calling with multiple arguments.//// See [Observer1.Without] for an example.func ( *Observer4[, , , ]) ( ...Comp) *Observer4[, , , ] { .observer.Without(...)return}// Exclusive makes the observer exclusive in the sense that the components given by [Observer.With]// are matched exactly, and no other components are allowed.//// Overwrites components set via [Observer.Without].//// See [Observer1.Exclusive] for an example.func ( *Observer4[, , , ]) () *Observer4[, , , ] { .observer.Exclusive()return}// Do sets the observer's callback. Must be called exactly once before registration.func ( *Observer4[, , , ]) ( func(Entity, *, *, *, *)) *Observer4[, , , ] {if .callback != nil {panic("observer already has a callback") } .callback = return}// Register this observer. This is mandatory for the observer to take effect.func ( *Observer4[, , , ]) ( *World) *Observer4[, , , ] {if .callback == nil {panic("observer callback must be set via Do before registering") } := &.storage.components[ComponentID[]().id] := &.storage.components[ComponentID[]().id] := &.storage.components[ComponentID[]().id] := &.storage.components[ComponentID[]().id] .observer.callback = func( Entity) { := &.storage.entities[.id] := uintptr(.row) .callback( , (*)(.columns[.table].Get()), (*)(.columns[.table].Get()), (*)(.columns[.table].Get()), (*)(.columns[.table].Get()), ) } .registerObserver(&.observer)return}// Unregister this observer.func ( *Observer4[, , , ]) ( *World) *Observer4[, , , ] { .unregisterObserver(&.observer)return}
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.