DrawSystem:draw_entities
Draws all entities. This involves:
- Sorting all Drawable components according to their draw order.
- Iterating through all Drawable components and calling their
draw()method. These draws are:- Surrounded by calls to the associated draw effects
- Offset by the entity’s position if it has a Body
- Offset by the Drawable’s offset
Usage
draw_system:draw_entities()
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