Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QueryEntitiesByComponentId ¶
func QueryEntitiesByComponentId[T any](world *World, id ComponentId) []*T
func QueryEntity ¶
Types ¶
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
Component 组件是一个数据结构,它包含了一些数据
type ComponentId ¶
type ComponentId = int
type Entity ¶
type Entity struct {
// contains filtered or unexported fields
}
Entity 仅包含一个实体的唯一标识
func (Entity) GetArchetypeIndex ¶
type World ¶
type World struct {
// contains filtered or unexported fields
}
func (*World) ComponentId ¶
func (w *World) ComponentId(t reflect.Type) ComponentId
ComponentId 返回一个组件的 Id,如果组件未注册,则注册它
func (*World) CreateEntity ¶
func (w *World) CreateEntity(componentId ComponentId, componentIds ...ComponentId) Entity
CreateEntity 创建一个新的实体
Click to show internal directories.
Click to hide internal directories.