GRRLIB library function prototypes. More...
Functions | |
GRRLIB_bytemapFont * | GRRLIB_LoadBMF (const u8 my_bmf[]) |
Load a ByteMap font structure from a buffer. | |
void | GRRLIB_FreeBMF (const GRRLIB_bytemapFont *bmf) |
Free memory allocated by ByteMap fonts. | |
void | GRRLIB_InitTileSet (GRRLIB_texImg *tex, const uint tilew, const uint tileh, const uint tilestart) |
Initialize a tile set. | |
void | GRRLIB_BMFX_FlipH (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest) |
Flip texture horizontal. | |
void | GRRLIB_BMFX_FlipV (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest) |
Flip texture vertical. | |
void | GRRLIB_BMFX_Grayscale (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest) |
Change a texture to gray scale. | |
void | GRRLIB_BMFX_Sepia (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest) |
Change a texture to sepia (old photo style). | |
void | GRRLIB_BMFX_Invert (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest) |
Invert colors of the texture. | |
void | GRRLIB_BMFX_Blur (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest, const u32 factor) |
A texture effect (Blur). | |
void | GRRLIB_BMFX_Scatter (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest, const u32 factor) |
A texture effect (Scatter). | |
void | GRRLIB_BMFX_Pixelate (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest, const u32 factor) |
A texture effect (Pixelate). | |
int | GRRLIB_Init (void) |
Initialize GRRLIB. | |
void | GRRLIB_Exit (void) |
Call this before exiting your application. | |
void | GRRLIB_Circle (const f32 x, const f32 y, const f32 radius, const u32 color, const u8 filled) |
Draw a circle. | |
int | GRRLIB_LoadFile (const char *filename, unsigned char **data) |
Load a file to memory. | |
GRRLIB_texImg * | GRRLIB_LoadTextureFromFile (const char *filename) |
Load a texture from a file. | |
bool | GRRLIB_ScrShot (const char *filename) |
Make a PNG screenshot on the SD card. | |
void | GRRLIB_Printf (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex, const u32 color, const f32 zoom, const char *text,...) |
GRRLIB_print.c - Will someome please tell me what these are :). | |
void | GRRLIB_PrintBMF (const f32 xpos, const f32 ypos, const GRRLIB_bytemapFont *bmf, const f32 zoom, const char *text,...) |
Print formatted output with a ByteMap font. | |
void | GRRLIB_DrawImg (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex, const f32 degrees, const f32 scaleX, const f32 scaleY, const u32 color) |
Draw a texture. | |
void | GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex, const u32 color) |
Draw a textured quad. | |
void | GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex, const f32 degrees, const f32 scaleX, const f32 scaleY, const u32 color, const int frame) |
Draw a tile. | |
void | GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex, const u32 color, const int frame) |
Draw a tile in a quad. | |
void | GRRLIB_Render (void) |
Call this function after drawing. | |
void | GRRLIB_Screen2Texture (GRRLIB_texImg *tex) |
Make a snapshot of the screen in a texture. | |
GRRLIB_texImg * | GRRLIB_LoadTexture (const u8 *my_img) |
GRRLIB_texImg * | GRRLIB_LoadTexturePNG (const u8 *my_png) |
Load a texture from a buffer. | |
GRRLIB_texImg * | GRRLIB_LoadTextureJPG (const u8 *my_jpg) |
Load a texture from a buffer. | |
void | GRRLIB_Compose (int xoff, int yoff, GRRLIB_texImg *layer, GRRLIB_texImg *canvas, GRRLIB_ComposeMode mode) |
Compose a layer/sprite to a canvas/textured-image. |
GRRLIB library function prototypes.
void GRRLIB_BMFX_Blur | ( | const GRRLIB_texImg * | texsrc, | |
GRRLIB_texImg * | texdest, | |||
const u32 | factor | |||
) |
A texture effect (Blur).
texsrc | The texture source. | |
texdest | The texture destination. | |
factor | The blur factor. |
void GRRLIB_BMFX_FlipH | ( | const GRRLIB_texImg * | texsrc, | |
GRRLIB_texImg * | texdest | |||
) |
Flip texture horizontal.
texsrc | The texture source. | |
texdest | The texture destination. |
void GRRLIB_BMFX_FlipV | ( | const GRRLIB_texImg * | texsrc, | |
GRRLIB_texImg * | texdest | |||
) |
Flip texture vertical.
texsrc | The texture source. | |
texdest | The texture destination. |
void GRRLIB_BMFX_Grayscale | ( | const GRRLIB_texImg * | texsrc, | |
GRRLIB_texImg * | texdest | |||
) |
Change a texture to gray scale.
texsrc | The texture source. | |
texdest | The texture grayscaled destination. |
void GRRLIB_BMFX_Invert | ( | const GRRLIB_texImg * | texsrc, | |
GRRLIB_texImg * | texdest | |||
) |
Invert colors of the texture.
texsrc | The texture source. | |
texdest | The texture destination. |
void GRRLIB_BMFX_Pixelate | ( | const GRRLIB_texImg * | texsrc, | |
GRRLIB_texImg * | texdest, | |||
const u32 | factor | |||
) |
A texture effect (Pixelate).
texsrc | The texture source. | |
texdest | The texture destination. | |
factor | The factor level of the effect. |
void GRRLIB_BMFX_Scatter | ( | const GRRLIB_texImg * | texsrc, | |
GRRLIB_texImg * | texdest, | |||
const u32 | factor | |||
) |
A texture effect (Scatter).
texsrc | The texture source. | |
texdest | The texture destination. | |
factor | The factor level of the effect. |
void GRRLIB_BMFX_Sepia | ( | const GRRLIB_texImg * | texsrc, | |
GRRLIB_texImg * | texdest | |||
) |
Change a texture to sepia (old photo style).
texsrc | The texture source. | |
texdest | The texture destination. |
void GRRLIB_Circle | ( | const f32 | x, | |
const f32 | y, | |||
const f32 | radius, | |||
const u32 | color, | |||
const u8 | filled | |||
) |
Draw a circle.
x | Specifies the x-coordinate of the circle. | |
y | Specifies the y-coordinate of the circle. | |
radius | The radius of the circle. | |
color | The color of the circle in RGBA format. | |
filled | Set to true to fill the circle. |
void GRRLIB_Compose | ( | int | xoff, | |
int | yoff, | |||
GRRLIB_texImg * | layer, | |||
GRRLIB_texImg * | canvas, | |||
GRRLIB_ComposeMode | mode | |||
) |
Compose a layer/sprite to a canvas/textured-image.
Currently only performs "a-over-b (normal) alpha compositing" (opacity) Ie. Light source is behind the eye, not behind the canvas!
xoff | : The x-offset within the canvas (negative values allowed) | |
yoff | : The y-offset within the canvas (negative values allowed) | |
layer | : The layer/sprite to draw | |
canvas | : The canvas/textured-image on which to draw | |
mode | : Currently unused - will be composition mode |
void GRRLIB_DrawImg | ( | const f32 | xpos, | |
const f32 | ypos, | |||
const GRRLIB_texImg * | tex, | |||
const f32 | degrees, | |||
const f32 | scaleX, | |||
const f32 | scaleY, | |||
const u32 | color | |||
) |
Draw a texture.
xpos | Specifies the x-coordinate of the upper-left corner. | |
ypos | Specifies the y-coordinate of the upper-left corner. | |
tex | The texture to draw. | |
degrees | Angle of rotation. | |
scaleX | Specifies the x-coordinate scale. -1 could be used for flipping the texture horizontally. | |
scaleY | Specifies the y-coordinate scale. -1 could be used for flipping the texture vertically. | |
color | Color in RGBA format. |
void GRRLIB_DrawImgQuad | ( | const guVector | pos[4], | |
GRRLIB_texImg * | tex, | |||
const u32 | color | |||
) |
Draw a textured quad.
pos | Vector array of the 4 points. | |
tex | The texture to draw. | |
color | Color in RGBA format. |
void GRRLIB_DrawTile | ( | const f32 | xpos, | |
const f32 | ypos, | |||
const GRRLIB_texImg * | tex, | |||
const f32 | degrees, | |||
const f32 | scaleX, | |||
const f32 | scaleY, | |||
const u32 | color, | |||
const int | frame | |||
) |
Draw a tile.
xpos | Specifies the x-coordinate of the upper-left corner. | |
ypos | Specifies the y-coordinate of the upper-left corner. | |
tex | The texture containing the tile to draw. | |
degrees | Angle of rotation. | |
scaleX | Specifies the x-coordinate scale. -1 could be used for flipping the texture horizontally. | |
scaleY | Specifies the y-coordinate scale. -1 could be used for flipping the texture vertically. | |
color | Color in RGBA format. | |
frame | Specifies the frame to draw. |
void GRRLIB_DrawTileQuad | ( | const guVector | pos[4], | |
GRRLIB_texImg * | tex, | |||
const u32 | color, | |||
const int | frame | |||
) |
Draw a tile in a quad.
pos | Vector array of the 4 points. | |
tex | The texture to draw. | |
color | Color in RGBA format. | |
frame | Specifies the frame to draw. |
void GRRLIB_FreeBMF | ( | const GRRLIB_bytemapFont * | bmf | ) |
Free memory allocated by ByteMap fonts.
bmf | A GRRLIB_bytemapFont structure. |
int GRRLIB_Init | ( | void | ) |
Initialize GRRLIB.
Call this at the beginning your code.
void GRRLIB_InitTileSet | ( | GRRLIB_texImg * | tex, | |
const uint | tilew, | |||
const uint | tileh, | |||
const uint | tilestart | |||
) |
Initialize a tile set.
tex | The texture to initialize. | |
tilew | Width of the tile. | |
tileh | Height of the tile. | |
tilestart | Offset for starting position (Used in fonts). |
GRRLIB_bytemapFont* GRRLIB_LoadBMF | ( | const u8 | my_bmf[] | ) |
Load a ByteMap font structure from a buffer.
my_bmf | The ByteMap font buffer to load. |
int GRRLIB_LoadFile | ( | const char * | filename, | |
unsigned char ** | data | |||
) |
Load a file to memory.
filename | Name of the file to be loaded. | |
data | Pointer-to-your-pointer. Ie. { u8 *data; load("file", &data); }. It is your responsibility to free the memory allocated by this function. |
GRRLIB_texImg* GRRLIB_LoadTextureFromFile | ( | const char * | filename | ) |
Load a texture from a file.
filename | The JPEG or PNG filename to load. |
GRRLIB_texImg* GRRLIB_LoadTextureJPG | ( | const u8 * | my_jpg | ) |
Load a texture from a buffer.
Take care to have the JPG finnish with 0xFF 0xD9!!
my_jpg | The JPEG buffer to load. |
GRRLIB_texImg* GRRLIB_LoadTexturePNG | ( | const u8 * | my_png | ) |
Load a texture from a buffer.
my_png | the PNG buffer to load. |
void GRRLIB_PrintBMF | ( | const f32 | xpos, | |
const f32 | ypos, | |||
const GRRLIB_bytemapFont * | bmf, | |||
const f32 | zoom, | |||
const char * | text, | |||
... | ||||
) |
Print formatted output with a ByteMap font.
xpos | Specifies the x-coordinate of the upper-left corner of the text. | |
ypos | Specifies the y-coordinate of the upper-left corner of the text. | |
bmf | The ByteMap font to use. | |
zoom | This is a factor by which the text size will be increase or decrease. | |
text | Text to draw. | |
... | Optional arguments. |
void GRRLIB_Printf | ( | const f32 | xpos, | |
const f32 | ypos, | |||
const GRRLIB_texImg * | tex, | |||
const u32 | color, | |||
const f32 | zoom, | |||
const char * | text, | |||
... | ||||
) |
GRRLIB_print.c - Will someome please tell me what these are :).
GRRLIB_print.c - Will someome please tell me what these are :).
xpos | Specifies the x-coordinate of the upper-left corner of the text. | |
ypos | Specifies the y-coordinate of the upper-left corner of the text. | |
tex | The texture containing the character set. | |
color | Text color in RGBA format. The alpha channel is used to change the opacity of the text. | |
zoom | This is a factor by which the text size will be increase or decrease. | |
text | Text to draw. | |
... | Optional arguments. |
void GRRLIB_Screen2Texture | ( | GRRLIB_texImg * | tex | ) |
Make a snapshot of the screen in a texture.
tex | A pointer to a texture representing the screen or NULL if an error occurs. |
bool GRRLIB_ScrShot | ( | const char * | filename | ) |
Make a PNG screenshot on the SD card.
libfat is required to use the function.
filename | name of the file to write. |