GRRLIB.h File Reference

GRRLIB library. More...

#include <gccore.h>

Data Structures

struct  GRRLIB_texImg
 Structure to hold the texture informations. More...
struct  GRRLIB_bytemapChar
 Structure to hold the bytemap character informations. More...
struct  GRRLIB_bytemapFont
 Structure to hold the bytemap font informations. More...

Functions

void GRRLIB_FillScreen (u32 color)
 Clear screen with a specific color.
void GRRLIB_Plot (f32 x, f32 y, u32 color)
 Draw a dot.
void GRRLIB_NPlot (Vector v[], u32 color, long n)
 Draw an array of points.
void GRRLIB_Line (f32 x1, f32 y1, f32 x2, f32 y2, u32 color)
 Draw a line.
void GRRLIB_Rectangle (f32 x, f32 y, f32 width, f32 height, u32 color, u8 filled)
 Draw a rectangle.
void GRRLIB_Circle (f32 x, f32 y, f32 radius, u32 color, u8 filled)
 Draw a circle.
void GRRLIB_NGone (Vector v[], u32 color, long n)
 Draw a polygon.
void GRRLIB_NGoneFilled (Vector v[], u32 color, long n)
 Draw a filled polygon.
GRRLIB_texImg GRRLIB_CreateEmptyTexture (unsigned int, unsigned int)
 Create an empty texture.
GRRLIB_texImg GRRLIB_LoadTexture (const unsigned char my_img[])
 Load a texture from a buffer.
GRRLIB_bytemapFont GRRLIB_LoadBMF (const unsigned char my_bmf[])
 Load a ByteMap font structure from a buffer.
void GRRLIB_FreeBMF (GRRLIB_bytemapFont bmf)
 Free memory.
void GRRLIB_InitTileSet (struct GRRLIB_texImg *tex, unsigned int tilew, unsigned int tileh, unsigned int tilestart)
 Initialize a tile set.
void GRRLIB_DrawImg (f32 xpos, f32 ypos, GRRLIB_texImg tex, float degrees, float scaleX, f32 scaleY, u32 color)
 Draw a texture.
void GRRLIB_DrawTile (f32 xpos, f32 ypos, GRRLIB_texImg tex, float degrees, float scaleX, f32 scaleY, u32 color, int frame)
 Draw a tile.
void GRRLIB_Printf (f32 xpos, f32 ypos, GRRLIB_texImg tex, u32 color, f32 zoom, const char *text,...)
 Print formatted output.
void GRRLIB_PrintBMF (f32 xpos, f32 ypos, GRRLIB_bytemapFont bmf, f32 zoom, const char *text,...)
 Print formatted output.
bool GRRLIB_PtInRect (int hotx, int hoty, int hotw, int hoth, int wpadx, int wpady)
 Determines whether the specified point lies within the specified rectangle.
bool GRRLIB_RectInRect (int rect1x, int rect1y, int rect1w, int rect1h, int rect2x, int rect2y, int rect2w, int rect2h)
 Determines whether a specified rectangle lies within another rectangle.
bool GRRLIB_RectOnRect (int rect1x, int rect1y, int rect1w, int rect1h, int rect2x, int rect2y, int rect2w, int rect2h)
 Determines whether a part of a specified rectangle lies on another rectangle.
u32 GRRLIB_GetPixelFromtexImg (int x, int y, GRRLIB_texImg tex)
 Return the color value of a pixel from a GRRLIB_texImg.
void GRRLIB_SetPixelTotexImg (int x, int y, GRRLIB_texImg tex, u32 color)
 Set the color value of a pixel to a GRRLIB_texImg.
void GRRLIB_FlushTex (GRRLIB_texImg tex)
 Writes the contents of a texture in the data cache down to main memory.
void GRRLIB_BMFX_Grayscale (GRRLIB_texImg texsrc, GRRLIB_texImg texdest)
 Change a texture to gray scale.
void GRRLIB_BMFX_Invert (GRRLIB_texImg texsrc, GRRLIB_texImg texdest)
 Invert colors of the texture.
void GRRLIB_BMFX_FlipH (GRRLIB_texImg texsrc, GRRLIB_texImg texdest)
 Flip texture horizontal.
void GRRLIB_BMFX_FlipV (GRRLIB_texImg texsrc, GRRLIB_texImg texdest)
 Flip texture vertical.
void GRRLIB_BMFX_Blur (GRRLIB_texImg texsrc, GRRLIB_texImg texdest, int factor)
 Blur a texture.
void GRRLIB_BMFX_Scatter (GRRLIB_texImg texsrc, GRRLIB_texImg texdest, int factor)
 A texture effect.
void GRRLIB_BMFX_Pixelate (GRRLIB_texImg texsrc, GRRLIB_texImg texdest, int factor)
 A texture effect.
void GRRLIB_GXEngine (Vector v[], u32 color, long count, u8 fmt)
void GRRLIB_Init ()
 Initialize GRRLIB.
void GRRLIB_Render ()
 Call this function after drawing.
void GRRLIB_Exit ()
 Call this before exiting your application.

Variables

Mtx GXmodelView2D


Detailed Description

GRRLIB library.


Function Documentation

void GRRLIB_BMFX_Blur ( GRRLIB_texImg  texsrc,
GRRLIB_texImg  texdest,
int  factor 
)

Blur a texture.

See also:
GRRLIB_FlushTex
Parameters:
texsrc the texture source.
texdest the texture destination.
factor the blur factor.

void GRRLIB_BMFX_FlipH ( 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 ( 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 ( 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 ( 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 ( GRRLIB_texImg  texsrc,
GRRLIB_texImg  texdest,
int  factor 
)

A texture effect.

See also:
GRRLIB_FlushTex
Parameters:
texsrc the texture source.
texdest the texture destination.
factor The factor level of the effect.

void GRRLIB_BMFX_Scatter ( GRRLIB_texImg  texsrc,
GRRLIB_texImg  texdest,
int  factor 
)

A texture effect.

See also:
GRRLIB_FlushTex
Parameters:
texsrc the texture source.
texdest the texture destination.
factor The factor level of the effect.

void GRRLIB_Circle ( f32  x,
f32  y,
f32  radius,
u32  color,
u8  filled 
) [inline]

Draw a circle.

Author:
Dark_Link
Parameters:
x 
y 
radius the radius of the circle.
color the color of the circle in RGBA format.
filled true to fill the circle with a color.

GRRLIB_texImg GRRLIB_CreateEmptyTexture ( unsigned int  w,
unsigned int  h 
)

Create an empty texture.

Parameters:
w width of the new texture to create.
h height of the new texture to create.
Returns:
A GRRLIB_texImg structure newly created.

void GRRLIB_DrawImg ( f32  xpos,
f32  ypos,
GRRLIB_texImg  tex,
float  degrees,
float  scaleX,
f32  scaleY,
u32  color 
) [inline]

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 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 

void GRRLIB_DrawTile ( f32  xpos,
f32  ypos,
GRRLIB_texImg  tex,
float  degrees,
float  scaleX,
f32  scaleY,
u32  color,
int  frame 
) [inline]

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 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 
frame specifies the frame to draw.

void GRRLIB_FillScreen ( u32  color  )  [inline]

Clear screen with a specific color.

Parameters:
color the color to use to fill the screen.

void GRRLIB_FlushTex ( GRRLIB_texImg  tex  ) 

Writes the contents of a texture in the data cache down to main memory.

For performance the CPU holds a data cache where modifications are stored before they get written down to mainmemory.

Parameters:
tex the texture to flush.

void GRRLIB_FreeBMF ( GRRLIB_bytemapFont  bmf  ) 

Free memory.

Parameters:
bmf a GRRLIB_bytemapFont structure.

u32 GRRLIB_GetPixelFromtexImg ( int  x,
int  y,
GRRLIB_texImg  tex 
)

Return the color value of a pixel from a GRRLIB_texImg.

Parameters:
x specifies the x-coordinate of the pixel in the texture.
y specifies the y-coordinate of the pixel in the texture.
tex texture to get the color from.
Returns:
The color of a pixel in RGBA format.

void GRRLIB_GXEngine ( Vector  v[],
u32  color,
long  n,
u8  fmt 
)

Parameters:
v 
color 
n 
fmt 

void GRRLIB_Init (  ) 

Initialize GRRLIB.

Call this at the beginning your code.

See also:
GRRLIB_Exit

void GRRLIB_InitTileSet ( struct GRRLIB_texImg tex,
unsigned int  tilew,
unsigned int  tileh,
unsigned int  tilestart 
)

Initialize a tile set.

Parameters:
tex texture to initialize.
tilew widht of the tile.
tileh height of the tile.
tilestart offset for starting position.

void GRRLIB_Line ( f32  x1,
f32  y1,
f32  x2,
f32  y2,
u32  color 
) [inline]

Draw a line.

Parameters:
x1 start point for line for the x coordinate.
y1 start point for line for the y coordinate.
x2 end point for line for the x coordinate.
y2 end point for line for the x coordinate.
color line color in RGBA format.

GRRLIB_bytemapFont GRRLIB_LoadBMF ( const unsigned char  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.

GRRLIB_texImg GRRLIB_LoadTexture ( const unsigned char  my_img[]  ) 

Load a texture from a buffer.

Parameters:
my_img the JPEG or PNG buffer to load.
Returns:
A GRRLIB_texImg structure filled with imgage informations.

void GRRLIB_NGone ( Vector  v[],
u32  color,
long  n 
)

Draw a polygon.

Parameters:
v 
color the color of the polygon in RGBA format.
n 

void GRRLIB_NGoneFilled ( Vector  v[],
u32  color,
long  n 
)

Draw a filled polygon.

Parameters:
v 
color the color of the filled polygon in RGBA format.
n 

void GRRLIB_NPlot ( Vector  v[],
u32  color,
long  n 
)

Draw an array of points.

Parameters:
v array containing the points.
color the color of the points in RGBA format.
n number of points in the vector array.

void GRRLIB_Plot ( f32  x,
f32  y,
u32  color 
) [inline]

Draw a dot.

Parameters:
x specifies the x-coordinate of the dot.
y specifies the y-coordinate of the dot.
color the color of the dot in RGBA format.

void GRRLIB_PrintBMF ( f32  xpos,
f32  ypos,
GRRLIB_bytemapFont  bmf,
f32  zoom,
const char *  text,
  ... 
)

Print formatted output.

Parameters:
xpos 
ypos 
bmf 
zoom 
text text to draw.
... Optional arguments.

void GRRLIB_Printf ( f32  xpos,
f32  ypos,
GRRLIB_texImg  tex,
u32  color,
f32  zoom,
const char *  text,
  ... 
)

Print formatted output.

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

bool GRRLIB_PtInRect ( int  hotx,
int  hoty,
int  hotw,
int  hoth,
int  wpadx,
int  wpady 
)

Determines whether the specified point lies within the specified rectangle.

Parameters:
hotx specifies the x-coordinate of the upper-left corner of the rectangle.
hoty specifies the y-coordinate of the upper-left corner of the rectangle.
hotw the width of the rectangle.
hoth the height of the rectangle.
wpadx specifies the x-coordinate of the point.
wpady specifies the y-coordinate of the point.
Returns:
If the specified point lies within the rectangle, the return value is true otherwise it's false.

void GRRLIB_Rectangle ( f32  x,
f32  y,
f32  width,
f32  height,
u32  color,
u8  filled 
) [inline]

Draw a rectangle.

Parameters:
x specifies the x-coordinate of the upper-left corner of the rectangle.
y specifies the y-coordinate of the upper-left corner of the rectangle.
width the width of the rectangle.
height the height of the rectangle.
color the color of the rectangle in RGBA format.
filled true to fill the rectangle with a color.

bool GRRLIB_RectInRect ( int  rect1x,
int  rect1y,
int  rect1w,
int  rect1h,
int  rect2x,
int  rect2y,
int  rect2w,
int  rect2h 
)

Determines whether a specified rectangle lies within another rectangle.

Parameters:
rect1x specifies the x-coordinate of the upper-left corner of the rectangle.
rect1y specifies the y-coordinate of the upper-left corner of the rectangle.
rect1w specifies the width of the rectangle.
rect1h specifies the height of the rectangle.
rect2x specifies the x-coordinate of the upper-left corner of the rectangle.
rect2y specifies the y-coordinate of the upper-left corner of the rectangle.
rect2w specifies the width of the rectangle.
rect2h specifies the height of the rectangle.
Returns:
If the specified rectangle lies within the other rectangle, the return value is true otherwise it's false.

bool GRRLIB_RectOnRect ( int  rect1x,
int  rect1y,
int  rect1w,
int  rect1h,
int  rect2x,
int  rect2y,
int  rect2w,
int  rect2h 
)

Determines whether a part of a specified rectangle lies on another rectangle.

Parameters:
rect1x specifies the x-coordinate of the upper-left corner of the first rectangle.
rect1y specifies the y-coordinate of the upper-left corner of the first rectangle.
rect1w specifies the width of the first rectangle.
rect1h specifies the height of the first rectangle.
rect2x specifies the x-coordinate of the upper-left corner of the second rectangle.
rect2y specifies the y-coordinate of the upper-left corner of the second rectangle.
rect2w specifies the width of the second rectangle.
rect2h specifies the height of the second rectangle.
Returns:
If the specified rectangle lies on the other rectangle, the return value is true otherwise it's false.

void GRRLIB_SetPixelTotexImg ( int  x,
int  y,
GRRLIB_texImg  tex,
u32  color 
)

Set the color value of a pixel to a GRRLIB_texImg.

See also:
GRRLIB_FlushTex
Parameters:
x specifies the x-coordinate of the pixel in the texture.
y specifies the y-coordinate of the pixel in the texture.
tex texture to set the color to.
color the color of the pixel in RGBA format.


Generated on Wed Mar 4 17:48:39 2009 for GRRLIB by  doxygen 1.5.8