DrawSystem:update_drawables
Runs update logic for drawables that have any. This involves:
- Updating the current keyframe of all AnimatedSprite components.
- Updating the script and layout of all WorldWidget components.
If you have unrelated scripts joining on threads managed by these components (such as threads returned by AnimatedSprite:play_animation), they may resume execution during this call.
Usage
draw_system:update_drawables(delta_time)
Arguments
| Name | Type | Description |
|---|---|---|
delta_time | number | Time since previous update, in seconds. |
Examples
local MyScene = Class("MyScene", crystal.Scene);
MyScene.init = function(self)
self.ecs = crystal.ECS:new();
self.draw_system = self.ecs:add_system(crystal.DrawSystem);
end
MyScene.update = function(self, delta_time)
self.draw_system:update_drawables(delta_time);
end
MyScene.draw = function(self)
self.draw_system:draw_entities();
end