![]() |
Gorgon Game Engine
|
Components are the building blocks of widgets.
They are the visual elements that makes up most of the visual aspect of a widget. Components have templates, which they use as basis for their placement and drawing. ComponentTemplate is the base class for all component templates. Components have component index and component condition (see ComponentCondition) to control which components will be visible at a given instance. Components have the same component indices but only one will be shown at a time. The components that have more specific condition will have precedence. For instance, if two components have index of 2 and one has condition of ComponentCondition::Always and the other has condition of ComponentCondition::Focused, first component will be displayed unless the widget has received focus, in that case the second one will be shown.
Every widget requires a container component at index 0 as the root. If this component has a non-0 size, the widget size will be fixed [this might change in the future].
Components can be modified by the widget data. This is controlled through data effect. Various data effects exist to suit different type of widgets. See the widget documentation for specific data exported by them.
See Component placement to learn how the components are spaced out.
See Component Example to learn how to create a simple button