GRRLIB__lib.h File Reference

GRRLIB library function prototypes. More...

Functions

GRRLIB_bytemapFontGRRLIB_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_texImgGRRLIB_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_texImgGRRLIB_LoadTexture (const u8 *my_img)
GRRLIB_texImgGRRLIB_LoadTexturePNG (const u8 *my_png)
 Load a texture from a buffer.
GRRLIB_texImgGRRLIB_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.

Detailed Description

GRRLIB library function prototypes.


Function Documentation

void GRRLIB_BMFX_Blur ( const GRRLIB_texImg texsrc,
GRRLIB_texImg texdest,
const u32  factor 
)

A texture effect (Blur).

See also:
GRRLIB_FlushTex
Parameters:
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.

See also:
GRRLIB_FlushTex
Parameters:
texsrc The texture source.
texdest The texture destination.
void GRRLIB_BMFX_FlipV ( const GRRLIB_texImg texsrc,
GRRLIB_texImg texdest 
)

Flip texture vertical.

See also:
GRRLIB_FlushTex
Parameters:
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.

See also:
GRRLIB_FlushTex
Parameters:
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.

See also:
GRRLIB_FlushTex
Parameters:
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).

See also:
GRRLIB_FlushTex
Parameters:
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).

See also:
GRRLIB_FlushTex
Parameters:
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).

See also:
GRRLIB_FlushTex
Parameters:
texsrc The texture source.
texdest The texture destination.
Author:
elisherer
void GRRLIB_Circle ( const f32  x,
const f32  y,
const f32  radius,
const u32  color,
const u8  filled 
)

Draw a circle.

Author:
Dark_Link
Parameters:
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!

Author:
BlueChip
Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
bmf A GRRLIB_bytemapFont structure.
int GRRLIB_Init ( void   ) 

Initialize GRRLIB.

Call this at the beginning your code.

Returns:
int 0=OK; -1=NoMemory; -2=NoFilingSystem
See also:
GRRLIB_Exit
void GRRLIB_InitTileSet ( GRRLIB_texImg tex,
const uint  tilew,
const uint  tileh,
const uint  tilestart 
)

Initialize a tile set.

Parameters:
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.

Parameters:
my_bmf The ByteMap font buffer to load.
Returns:
A GRRLIB_bytemapFont structure filled with BMF informations.
See also:
GRRLIB_FreeBMF
int GRRLIB_LoadFile ( const char *  filename,
unsigned char **  data 
)

Load a file to memory.

Parameters:
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.
Returns:
int 0:EmptyFile, -1:FileNotFound, -2:OutOfMemory, -3:FileReadError, >0 -> FileLength.
GRRLIB_texImg* GRRLIB_LoadTextureFromFile ( const char *  filename  ) 

Load a texture from a file.

Parameters:
filename The JPEG or PNG filename to load.
Returns:
A GRRLIB_texImg structure filled with image informations.
GRRLIB_texImg* GRRLIB_LoadTextureJPG ( const u8 *  my_jpg  ) 

Load a texture from a buffer.

Take care to have the JPG finnish with 0xFF 0xD9!!

Author:
DrTwox
Parameters:
my_jpg The JPEG buffer to load.
Returns:
A GRRLIB_texImg structure filled with image informations.
GRRLIB_texImg* GRRLIB_LoadTexturePNG ( const u8 *  my_png  ) 

Load a texture from a buffer.

Parameters:
my_png the PNG buffer to load.
Returns:
A GRRLIB_texImg structure filled with image informations.
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.

Parameters:
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 :).

Parameters:
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.

Parameters:
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.

Parameters:
filename name of the file to write.
Returns:
bool true=everything worked, false=problems occurred.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Fri Sep 25 14:44:35 2009 for GRRLIB by  doxygen 1.6.1