ecs
ecs
Types
20Archetype
Archetype :: struct {
hash: u64,
entities: [dynamic]Entity,
types: []Entity,
columns: [][]u8,
len: int,
edges: map[Entity]ArchetypeEdge,
}SourceArchetypeEdge
ArchetypeEdge :: struct {
add: ^Archetype,
remove: ^Archetype,
}SourceComponent
Component :: union {
Entity,
typeid,
}SourceEntity
Entity :: u64SourceEntityRecord
EntityRecord :: struct {
archetype: ^Archetype,
row: int,
gen: u16,
}SourceIter
Iter :: struct {
world: ^World,
query: ^Query,
entity: Entity,
_arch_idx: int,
_row: int,
}SourceIter1
Iter1 :: struct {}SourceIter2
Iter2 :: struct {}SourceIter3
Iter3 :: struct {}SourceIter4
Iter4 :: struct {}SourceIter5
Iter5 :: struct {}SourceIter6
Iter6 :: struct {}SourcePair
Pair :: struct {
relation: Component,
target: Component,
}SourceQuery
Query :: struct {
hash: u64,
terms: [16]QueryTerm,
archetypes: [dynamic]^Archetype,
}SourceQueryTerm
QueryTerm :: struct {
id: Entity,
mode: TermType,
}SourceQueryTermInput
QueryTermInput :: struct {
data: TermData,
mode: TermType,
}SourceTermData
TermData :: union {
Component,
Pair,
}SourceTermType
TermType :: enum u64 {
With = 0,
Without = 1,
}SourceTypeInfo
TypeInfo :: struct {
id: Entity,
size: int,
align: int,
}SourceWorld
World :: struct {
entity_index: [dynamic]EntityRecord,
free_indices: [dynamic]u32,
archetypes: map[u64]^Archetype,
queries: map[u64]^Query,
type_info: map[Entity]TypeInfo,
component_id: map[typeid]Entity,
component_index: map[Entity][dynamic]^Archetype,
arena: virtual.Arena,
}SourceConstants
3Procedures
13count_entites
count_entites :: proc(query: ^Query) -> (count: int)Sourcecreate_entity
create_entity :: proc(world: ^World) -> (Entity)Sourcecreate_world
create_world :: proc(capacity: untyped integer = 1024, allocator: mem.Allocator = context.allocator) -> (^World)Sourcedestroy_entity
destroy_entity :: proc(world: ^World, entity: Entity)Sourcedestroy_world
destroy_world :: proc(world: ^World)Sourceget_children
get_children :: proc(world: ^World, parent: Entity) -> ([]^Archetype)Sourceget_components
get_components :: proc(world: ^World, entity: Entity) -> ([]Entity)Sourceget_parent
get_parent :: proc(world: ^World, child: Entity) -> (bool, Entity)Sourcehas_parent
has_parent :: proc(world: ^World, child: Entity) -> (bool)Sourceis_alive
is_alive :: proc(world: ^World, entity: Entity) -> (bool)Sourcequery
query :: proc(world: ^World, inputs) -> (^Query)Sourceremove_parent
remove_parent :: proc(world: ^World, child: Entity)Sourceset_parent
set_parent :: proc(world: ^World, child: Entity, parent: Entity)SourceProcedure Groups
13add
add :: proc{}Sourceget
get :: proc{}Sourceget_archetypes
get_archetypes :: proc{}Sourceget_target
get_target :: proc{}Sourceget_view
get_view :: proc{}Sourcehas
has :: proc{}Sourceiter
iter :: proc{}Sourcenext
next :: proc{}Sourcepair
pair :: proc{}Sourceremove
remove :: proc{}Sourceset
set :: proc{}Sourcewith
with :: proc{}Sourcewithout
without :: proc{}Source