Skip to content

Instantly share code, notes, and snippets.

@eugeneko
Last active August 30, 2018 20:40
Show Gist options
  • Select an option

  • Save eugeneko/943a159ee1590b054f6be6a468abcdb9 to your computer and use it in GitHub Desktop.

Select an option

Save eugeneko/943a159ee1590b054f6be6a468abcdb9 to your computer and use it in GitHub Desktop.
EnTT API Summary

EnTT API Summary

Registry

Entities

Function Description
create Create an entity
destroy(e) Destroy the entity by ID
destroy<T>() Destroy the entity by component(s)/tag
valid Check whether the entity ID is valid
version Get version stored in the entity ID
current Get actual version of the entity

Components and tags

Function Description
assign Create new component/tag
replace Replace existing component/tag
accommodate Create new or replace existing component/tag
has Check whether the entity has the component(s)/tag
get Get existing component(s)/tag from the entity
remove Remove existing component/tag from the entity
reset<T>(e) Remove component from the entity
reset<T>() Remove all components of the given type
reset() Remove all entities and components
attachee Get entity of the given tag

Callbacks

Function Description
construction.connect Add callback for the component/tag construction
construction.disconnect Remove callback for the component/tag construction
destruction.connect Add callback for the component/tag destruction
destruction.disconnect Remove callback for the component/tag destruction

Views

Function Description
view<T>() Create standard view for given component type(s)
view<T>(raw_t) Create raw view for given component type
view<T>(persistent_t) Create persistent view for given component types
view(begin, end) Create runtime view for given dynamic component types
prepare<T>() Prepare for using persisten view for given component types
each Iterate over each entity
orphans Iterate over each entity without components and tags

Miscellaneous

Function Description
type<T>() Get dynamic type of the component/tag
sort<T>(c, s) Sort components of the given type using compare function and sort algorithm
sort<T1, T2>() Sort components to minimize cache missies during iteration over <T1, T2>
snapshot Get snapshot for serialization
restore Get snapshot loader for deserialization
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment