Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
Loading...
Searching...
No Matches
wsg.c File Reference

Functions

void rotatePixel (int16_t *x, int16_t *y, int16_t rotateDeg, int16_t width, int16_t height)
 
void drawWsg (const wsg_t *wsg, int16_t xOff, int16_t yOff, bool flipLR, bool flipUD, int16_t rotateDeg)
 Draw a WSG to the display.
 
void drawWsgSimple (const wsg_t *wsg, int16_t xOff, int16_t yOff)
 Draw a WSG to the display without flipping or rotation.
 
void drawWsgSimpleScaled (const wsg_t *wsg, int16_t xOff, int16_t yOff, int16_t xScale, int16_t yScale)
 Draw a WSG to the display without flipping or rotation.
 
void drawWsgSimpleHalf (const wsg_t *wsg, int16_t xOff, int16_t yOff)
 Draw a WSG to the display without flipping or rotation at half size.
 
void drawWsgTile (const wsg_t *wsg, int32_t xOff, int32_t yOff)
 Quickly copy a WSG to the display without flipping or rotation or transparency.
 

Function Documentation

◆ rotatePixel()

void rotatePixel ( int16_t * x,
int16_t * y,
int16_t rotateDeg,
int16_t width,
int16_t height )

Transform a pixel's coordinates by rotation around the sprite's center point, then reflection over Y axis, then reflection over X axis, then translation

Parameters
xThe x coordinate of the pixel location to transform
yThe y coordinate of the pixel location to transform
rotateDegThe number of degrees to rotate clockwise, must be 0-359
widthThe width of the image
heightThe height of the image

◆ drawWsg()

void drawWsg ( const wsg_t * wsg,
int16_t xOff,
int16_t yOff,
bool flipLR,
bool flipUD,
int16_t rotateDeg )

Draw a WSG to the display.

Parameters
wsgThe WSG to draw to the display
xOffThe x offset to draw the WSG at
yOffThe y offset to draw the WSG at
flipLRtrue to flip the image across the Y axis
flipUDtrue to flip the image across the X axis
rotateDegThe number of degrees to rotate clockwise, must be 0-359

◆ drawWsgSimple()

void drawWsgSimple ( const wsg_t * wsg,
int16_t xOff,
int16_t yOff )

Draw a WSG to the display without flipping or rotation.

Parameters
wsgThe WSG to draw to the display
xOffThe x offset to draw the WSG at
yOffThe y offset to draw the WSG at

◆ drawWsgSimpleScaled()

void drawWsgSimpleScaled ( const wsg_t * wsg,
int16_t xOff,
int16_t yOff,
int16_t xScale,
int16_t yScale )

Draw a WSG to the display without flipping or rotation.

Parameters
wsgThe WSG to draw to the display
xOffThe x offset to draw the WSG at
yOffThe y offset to draw the WSG at
xScaleThe amount to scale the image horizontally
yScaleThe amount to scale the image vertically

◆ drawWsgSimpleHalf()

void drawWsgSimpleHalf ( const wsg_t * wsg,
int16_t xOff,
int16_t yOff )

Draw a WSG to the display without flipping or rotation at half size.

Parameters
wsgThe WSG to draw to the display
xOffThe x offset to draw the WSG at
yOffThe y offset to draw the WSG at

◆ drawWsgTile()

void drawWsgTile ( const wsg_t * wsg,
int32_t xOff,
int32_t yOff )

Quickly copy a WSG to the display without flipping or rotation or transparency.

If the source WSG does have transparency, an indeterminate color will be drawn to the TFT

Parameters
wsgThe WSG to draw to the display
xOffThe x offset to draw the WSG at
yOffThe y offset to draw the WSG at