|
Untitled
|
ECS creation and maintenance. More...
Go to the source code of this file.
Functions | |
| void | update_entities () |
| TODO: Entity update loop. | |
| void | STATES_INIT () |
| Initializes entity states, which are a registry of function pointers used for entity events and behaviors. | |
| PhysicsComponent * | create_physics_component (Entity *ent, CollisionType collision_type, PhysicsType physics_type) |
| Creates an physics component for an entity. | |
| AnimationComponent * | create_animation_component (Entity *ent) |
| Creates an animation component for an entity. | |
| Entity * | create_entity (AssetInstance *asset_instance, int mn_id, bool physics_component, bool animation_component) |
| Creates an entity using the free list of ENTITIES. | |
| void | destroy_entity (Entity *ent) |
| Deletes an entity by simply freeing it and its components. | |
Variables | |
| State | STATE_REGISTRY [MAX_ENTITY_STATES] |
| Registry for entity states used for entity events and behaviors. | |
| int | STATE_COUNT |
| The amount of states inside of STATE_REGISTRY. | |
ECS creation and maintenance.
Definition in file entity.h.
| void update_entities | ( | ) |
TODO: Entity update loop.
Definition at line 69 of file entity.c.
References ENTITIES, MAX_ENTITIES, Entity::pc, and update_entities().
Referenced by update_entities().
| void STATES_INIT | ( | ) |
Initializes entity states, which are a registry of function pointers used for entity events and behaviors.
Definition at line 23 of file entity.c.
References ESTATE_chair_interact(), ESTATE_PLAYER_INTERACT, State::fn, STATE_COUNT, STATE_REGISTRY, and STATES_INIT().
Referenced by init(), and STATES_INIT().
| PhysicsComponent * create_physics_component | ( | Entity * | ent, |
| CollisionType | collision_type, | ||
| PhysicsType | physics_type ) |
Creates an physics component for an entity.
| ent | Pointer to the entity |
| collision_type | What collision type is required |
| physics_type | What physics type is required for impulse calculations |
Definition at line 88 of file entity.c.
References Entity::aabb, CAST_VEC, create_physics_component(), PhysicsComponent::ent, PhysicsComponent::free, GLOBALS, init_PC(), MAX_PHYSICS_COMPONENTS, Entity::mesh_node, Globals::mesh_nodes, Entity::pc, MeshNode::pc, and PHYSICS_COMPONENTS.
Referenced by create_entity(), create_physics_component(), and render_entity_menu().
| AnimationComponent * create_animation_component | ( | Entity * | ent | ) |
Creates an animation component for an entity.
| ent | Pointer to the entity |
Definition at line 121 of file entity.c.
References Entity::ac, ANIMATION_COMPONENTS, create_animation_component(), AnimationComponent::ent, AnimationComponent::free, and MAX_ANIMATION_COMPONENTS.
Referenced by create_animation_component(), create_entity(), and render_entity_menu().
| Entity * create_entity | ( | AssetInstance * | asset_instance, |
| int | mn_id, | ||
| bool | physics_component, | ||
| bool | animation_component ) |
Creates an entity using the free list of ENTITIES.
| asset_instance | The entity's asset instance in ASSET_INSTANCES |
| mn_id | The entity's root mesh node |
| physics_component | If this entity will have a physics component |
| animation_component | If this entity will have an animation component |
Definition at line 153 of file entity.c.
References AssetInstance::aabb, Entity::aabb, Mesh::aabb, Entity::ac, CAST_VEC, MeshNode::collision_type, create_animation_component(), create_entity(), create_physics_component(), MeshNode::ent, ENTITIES, find_default_state(), Entity::free, GLOBALS, Entity::instance, MAX_ENTITIES, MeshNode::mesh, Entity::mesh_node, Globals::mesh_nodes, Globals::meshes, MeshNode::name, Entity::pc, MeshNode::physics_mode, Entity::skin, MeshNode::skin, and Entity::state.
Referenced by create_entity(), init_globals(), init_new_asset_instance(), and render_light_menu().
| void destroy_entity | ( | Entity * | ent | ) |
Deletes an entity by simply freeing it and its components.
| ent | Pointer to the entity |
Definition at line 224 of file entity.c.
References Entity::ac, destroy_entity(), AnimationComponent::free, Entity::free, PhysicsComponent::free, and Entity::pc.
Referenced by destroy_entity(), and execute_light_undo().
|
extern |
Registry for entity states used for entity events and behaviors.
Definition at line 14 of file entity.c.
Referenced by find_state_by_name(), and STATES_INIT().
|
extern |
The amount of states inside of STATE_REGISTRY.
Definition at line 15 of file entity.c.
Referenced by find_state_by_name(), and STATES_INIT().