Home | Features | Roadmap | Learn | Documentation | ||
Latest version: Tramway SDK 0.0.9 Github Quick links Home Get Started |
EntityComponentEntityComponents are re-usable parts for assembling Entities. Need to display a 3D model for an entity? Use a RenderComponent. Need to add entity to the physics simulation? Use a PhysicsComponent. Have an entity that simulates a frog and want to add frog behavior to other entities? Refactor the frog code into a FrogComponent. Most components are created in a way that you can use them without attaching them to an entity, so you can use a RenderComponent to render some UI elements, or a skybox or something like that, but in general they are used for constructing entities. Components can have dependencies on Resources. This can be automatically tracked. Unlike entities, which can be repeatedly loaded and unloaded, once a component is initialized, it can only be deleted. After that it will have to be reconstructed and reinitialized. Programming in C++
Components work something like this:
None of the constructors have any parameters – this is mostly due to the fact that I feel like the initialization code for components with a lot of parameters, and therefore very long constructors looks incredibly awful. If you want to create your own component, you can copy the header and implementation files of the TemplateComponent.
Component<TemplateComponent> template;
The |
|
|