Documentation ¶
Index ¶
- Constants
- type Entity
- type ID
- type Mask
- type Query
- type World
- func (w *World) Add(entity Entity, comps ...ID)
- func (w *World) Alive(entity Entity) bool
- func (w *World) ComponentID(tp reflect.Type) ID
- func (w *World) Get(entity Entity, comp ID) unsafe.Pointer
- func (w *World) Has(entity Entity, comp ID) bool
- func (w *World) NewEntity() Entity
- func (w *World) Query(comps ...ID) Query
- func (w *World) RemEntity(entity Entity) bool
- func (w *World) Remove(entity Entity, comps ...ID)
Constants ¶
const MaskTotalBits = 64
MaskTotalBits is the size of Mask in bits
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entity ¶
type Entity struct {
// contains filtered or unexported fields
}
Entity identifier TODO: Store ID and generation in a single uint64?
type ID ¶
type ID uint32
ID defines the format for the components identifier
func ComponentID ¶
ComponentID provides a way to get a component's ID via generics
type Mask ¶
type Mask uint64
Mask is a bitmask
func NewMask ¶
NewMask creates a new bitmask from a list of IDs If any ID is bigger or equal MaskTotalBits, it'll not be added to the mask Implementation taken from https://github.com/marioolofo/go-gameengine-ecs
func (Mask) Get ¶
Get reports if bit index defined by ID is true or false The return will be always false for bit >= MaskTotalBits
func (*Mask) Set ¶
Set sets the state of bit index to true or false This function has no effect for bit >= MaskTotalBits
func (Mask) TotalBitsSet ¶
TotalBitsSet returns how many bits are set in this mask
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query is an iterator to iterate entities
type World ¶
type World struct {
// contains filtered or unexported fields
}
World holds all ECS data
func (*World) ComponentID ¶
ComponentID returns the ID for a component type, and registers it if not already registered
func (*World) NewEntity ¶
NewEntity creates a new or recycled entity.
Do not use during Query iteration!