mirror of
https://github.com/bloeys/nmage.git
synced 2025-12-29 13:28:20 +00:00
Implement UpdateAllComps
This commit is contained in:
@ -22,6 +22,16 @@ type Entity struct {
|
||||
Comps []Comp
|
||||
}
|
||||
|
||||
func (e *Entity) HasFlag(ef EntityFlag) bool {
|
||||
return GetFlags(e.ID)&ef > 0
|
||||
}
|
||||
|
||||
func (e *Entity) UpdateAllComps() {
|
||||
for i := 0; i < len(e.Comps); i++ {
|
||||
e.Comps[i].Update()
|
||||
}
|
||||
}
|
||||
|
||||
func GetGeneration(id EntityHandle) byte {
|
||||
return byte(id >> GenerationShiftBits)
|
||||
}
|
||||
@ -34,10 +44,6 @@ func GetIndex(id EntityHandle) uint64 {
|
||||
return uint64(id & IndexBitMask)
|
||||
}
|
||||
|
||||
func (e *Entity) HasFlag(ef EntityFlag) bool {
|
||||
return GetFlags(e.ID)&ef > 0
|
||||
}
|
||||
|
||||
func NewEntityId(generation byte, flags EntityFlag, index uint64) EntityHandle {
|
||||
return EntityHandle(index | (uint64(generation) << GenerationShiftBits) | (uint64(flags) << FlagsShiftBits))
|
||||
}
|
||||
|
||||
3
main.go
3
main.go
@ -22,9 +22,6 @@ import (
|
||||
)
|
||||
|
||||
// @Todo:
|
||||
// Complete entity registry (e.g. HasEntity, GetEntity, Generational Indices etc...)
|
||||
// Helper functions to update active entities
|
||||
|
||||
// Integrate physx
|
||||
// Create VAO struct independent from VBO to support multi-VBO use cases (e.g. instancing)
|
||||
// Renderer batching
|
||||
|
||||
Reference in New Issue
Block a user