Struct lib2d_drawable

An entity that renders a graphical source, such as an image, to the display.


// Render a white 100x100 square.
lib2d_drawable d = {.x=200, .y=200, .w=100, .h=100, .color=0xffffffff};


void lib2d_draw(const lib2d_drawable* drawable)

Schedule a lib2d_drawable to be drawn when lib2d_render() is called.


float x

How many pixels from the left of the screen this drawable should render

float y

How many pixels down from the top of the screen this drawable should render

float w

Width of this drawable

float h

Height of this drawable

float rot

Rotation in radians

lib2d_image image

What image, if any, should be drawn. If NULL, a solid color will be drawn.

uint32_t color

Multiplies each pixel value of the referenced image by this color, stored in an RGBA format with the alpha channel being the least significant byte.

Use a value of 0xffffffff to render the original image.