Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
|
Provides palette swap functionality for Swadge.
Provides functionality to WSGs to use a palette a la the NES. See wsg.h for how these are implemented.
Clones all the current options for drawing WSGs, but all of them require a new parameter, 'palette' which is a array of paletteColor_t objects. The functions largely just intercepts the color given by the WSG and converts it based on the newColor map.
There are three setup functions:
If wsgPaletteReset() isn't called for the palette being used, all colors not specifically assigned will be black.
There are four drawing functions provided with the palette
Go to the source code of this file.
Data Structures | |
struct | wsgPalette_t |
Functions | |
void | drawWsgPalette (const wsg_t *wsg, int32_t xOff, int32_t yOff, wsgPalette_t *palette, bool flipLR, bool flipUD, int32_t rotateDeg) |
Draw a WSG to the display utilizing a palette. | |
void | drawWsgPaletteSimple (const wsg_t *wsg, int16_t xOff, int16_t yOff, wsgPalette_t *palette) |
Draw a WSG to the display without flipping or rotation. | |
void | drawWsgPaletteSimpleScaled (const wsg_t *wsg, int16_t xOff, int16_t yOff, wsgPalette_t *palette, int16_t xScale, int16_t yScale) |
Draw a WSG to the display without flipping or rotation. | |
void | drawWsgPaletteSimpleHalf (const wsg_t *wsg, int16_t xOff, int16_t yOff, wsgPalette_t *palette) |
Draw a WSG to the display without flipping or rotation at half size. | |
void | wsgPaletteReset (wsgPalette_t *palette) |
Resets the palette to initial state. | |
void | wsgPaletteSet (wsgPalette_t *palette, paletteColor_t replaced, paletteColor_t newColor) |
Sets a single color to the provided palette. | |
void | wsgPaletteSetGroup (wsgPalette_t *palette, paletteColor_t *replacedColors, paletteColor_t *newColors, uint8_t arrSize) |
struct wsgPalette_t |
Data Fields | ||
---|---|---|
paletteColor_t | newColors[217] | Color map. |
void drawWsgPalette | ( | const wsg_t * | wsg, |
int32_t | xOff, | ||
int32_t | yOff, | ||
wsgPalette_t * | palette, | ||
bool | flipLR, | ||
bool | flipUD, | ||
int32_t | rotateDeg ) |
Draw a WSG to the display utilizing a palette.
wsg | The WSG to draw to the display |
xOff | The x offset to draw the WSG at |
yOff | The y offset to draw the WSG at |
palette | The new palette used to translate the colors |
flipLR | true to flip the image across the Y axis |
flipUD | true to flip the image across the X axis |
rotateDeg | The number of degrees to rotate clockwise, must be 0-359 |
void drawWsgPaletteSimple | ( | const wsg_t * | wsg, |
int16_t | xOff, | ||
int16_t | yOff, | ||
wsgPalette_t * | palette ) |
Draw a WSG to the display without flipping or rotation.
wsg | The WSG to draw to the display |
xOff | The x offset to draw the WSG at |
yOff | The y offset to draw the WSG at |
palette | Color Map to use |
void drawWsgPaletteSimpleScaled | ( | const wsg_t * | wsg, |
int16_t | xOff, | ||
int16_t | yOff, | ||
wsgPalette_t * | palette, | ||
int16_t | xScale, | ||
int16_t | yScale ) |
Draw a WSG to the display without flipping or rotation.
wsg | The WSG to draw to the display |
xOff | The x offset to draw the WSG at |
yOff | The y offset to draw the WSG at |
palette | Color Map to use |
xScale | The amount to scale the image horizontally |
yScale | The amount to scale the image vertically |
void drawWsgPaletteSimpleHalf | ( | const wsg_t * | wsg, |
int16_t | xOff, | ||
int16_t | yOff, | ||
wsgPalette_t * | palette ) |
Draw a WSG to the display without flipping or rotation at half size.
wsg | The WSG to draw to the display |
xOff | The x offset to draw the WSG at |
yOff | The y offset to draw the WSG at |
palette | Color Map to use |
void wsgPaletteReset | ( | wsgPalette_t * | palette | ) |
Resets the palette to initial state.
palette | Color map to modify |
void wsgPaletteSet | ( | wsgPalette_t * | palette, |
paletteColor_t | replacedColor, | ||
paletteColor_t | newColor ) |
Sets a single color to the provided palette.
palette | Color map to modify |
replacedColor | Color to be replaced |
newColor | Color that will replace the previous |
void wsgPaletteSetGroup | ( | wsgPalette_t * | palette, |
paletteColor_t * | replacedColors, | ||
paletteColor_t * | newColors, | ||
uint8_t | arrSize ) |