crystal.Sprite
A Drawable component that can draw a love.Texture.
Constructor
Like all other components, Sprite components are created by calling Entity:add_component.
The constructor for Sprite expects two optional arguments, a love.Texture and a love.Quad.
Methods
| Name | Description |
|---|---|
| quad | Returns the love.Quad used to crop the texture drawn by this component. |
| set_texture | Sets the love.Texture drawn by this component. |
| set_quad | Sets the love.Quad used to crop the texture drawn by this component. |
| texture | Returns the love.Texture drawn by this component. |
Examples
local ecs = crystal.ECS:new();
local entity = ecs:spawn(crystal.Entity);
entity:add_component(crystal.Sprite, crystal.assets.get("assets/strawberry.png"));