Module game_objects

Source
Expand description

Runtime game object model types and functionality.

This module makes wide use of macros, which means that there’s quite a bit of the “plumbing” exposed in this module. The main parts to look into are Scene, define_system, and impl_game_object.

Macros§

define_system
Gutputs a closure that can be passed into Scene::run_system, handling extracting properly typed component columns based on the parameter list.
impl_game_object
Generates a GameObject impl block for a type.

Structs§

ComponentColumn
Generic storage for the components inside Scene.
ComponentInfo
Type description for allocation and type comparison of components. Generated by impl_game_object.
GameObjectHandle
Temporary handle for operating on specific game objects. Invalidated by Scene::delete.
GameObjectHandleIterator
Returns GameObjectHandles for referring to the game objects in e.g. Scene::delete.
Scene
Container for GameObjects.
SceneBuilder
Builder for Scene.

Enums§

SpawnError
Error type returned by Scene::spawn.

Constants§

MAX_COMPONENTS
The maximum amount of components in a GameObject type.

Traits§

GameObject
Trait that game object types implement to be able to be added to a Scene. Impl generated with impl_game_object.

Functions§

extract_component_column
Searches the columns for one containing components of type C, and returns it as a properly typed slice.

Type Aliases§

ComponentVec
An ArrayVec with capacity for MAX_COMPONENTS elements.