Sprite

A drawable object attached to a transformation

Can be either static (Texture) or dynamic (Animation)

struct Sprite {
float x;
float y;
float width;
float height;
float originX;
float originY;
float scaleX;
float scaleY;
float rotation;
bool flipX;
bool flipY;
Color color;
}

Constructors

this
this(in Texture tex)

Create a static sprite

this
this(scope Animation anim)

Create a dynamic sprite

Members

Functions

update
void update()

Update the sprite (only affects dynamic sprites)

Properties

source
Animation source [@property setter]

Set the source of the sprite to a dynamic animation

source
Texture source [@property setter]

Set the source of the sprite to a static texture

texture
const(Texture) texture [@property getter]

Get the current texture of the sprite

Meta