для этой страницы,
отображается код на другом
Custom Component System
Component System enables you to implement your application’s logic via a set of building blocks - components, and assign these blocks to nodes. A logic component integrates a node, a property and a C++ class containing logic implementation.
The basic workflow is as follows:
- Inherit a new C++ class representing your component from the ComponentBase Class.
- In the header file determine and declare the list of parameters to be used by this component. All of these parameters with their default values (if specified) will be stored in a dedicated property file.
- Implement component logic inside the certain functions (init(),update(),render(), etc.), that will be called by the corresponding functions of the Engine's main loop.
- Register the component in the Component system.
- Assign the created property to a node to give it the desired functionality.
Each time a property registered in the Component System is assigned to a node, an instance of the corresponding component is created. This instance will be deleted when the corresponding property is replaced with another one or removed from the node’s list, or when the node is deleted.
The logic of a certain component is active only when the corresponding node and property are enabled. Thus, you can enable/disable logic of each particular component at run time when necessary.
You can assign several properties corresponding to different components to a single node. The sequence in which the logic of components is executed is determined by the order of corresponding properties in the list.
You can also create components for existing properties.
Components can interact with other components and nodes.
The Custom Component System is extendable and can be easily modified to add the desired functionality if necessary.