crystal.WorldWidget
A Drawable component that can draw a UI Widget.
Constructor
Like all other components, WorldWidget components are created by calling Entity:add_component.
The constructor for WorldWidget expects one optional argument, a Widget.
Methods
| Name | Description |
|---|---|
| set_widget | Sets the widget managed by this component. |
| set_widget_anchor | Sets how to align the widget when drawing it. |
| update_widget | Updates and computes layout for the widget managed by this component. |
| widget | Returns the widget managed by this component. |
Examples
local MyWidget = Class("MyWidget", crystal.Widget);
MyWidget.init = function(self)
MyWidget.super.init(self);
end
local ecs = crystal.ECS:new();
local entity = ecs:spawn(crystal.Entity);
entity:add_component(crystal.WorldWidget, MyWidget:new());