GRRLIB  4.3.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Everything in GRRLIB

This is the complete list of functions, structures, defines, typedefs, enumerations and variables you may want to used to make your homebrew with GRRLIB. More...

Data Structures

struct  GRRLIB_drawSettings
 Structure to hold the current drawing settings. More...
 
struct  GRRLIB_texImg
 Structure to hold the texture information. More...
 
struct  GRRLIB_bytemapChar
 Structure to hold the bytemap character information. More...
 
struct  GRRLIB_bytemapFont
 Structure to hold the bytemap font information. More...
 
struct  GRRLIB_Font
 Structure to hold the TTF information. More...
 

Macros

#define GRRLIB_VER_STRING   "4.3.2"
 Version information for GRRLIB.
 
#define R(c)   (((c) >>24) &0xFF)
 Extract red component of colour. More...
 
#define G(c)   (((c) >>16) &0xFF)
 Extract green component of colour. More...
 
#define B(c)   (((c) >> 8) &0xFF)
 Extract blue component of colour. More...
 
#define A(c)   ( (c) &0xFF)
 Extract alpha component of colour. More...
 
#define RGBA(r, g, b, a)
 Build an RGB pixel from components. More...
 
#define GRRLIB_BLEND_NONE   (GRRLIB_BLEND_ALPHA)
 Alias for GRRLIB_BLEND_ALPHA. More...
 
#define GRRLIB_BLEND_LIGHT   (GRRLIB_BLEND_ADD)
 Alias for GRRLIB_BLEND_ADD. More...
 
#define GRRLIB_BLEND_SHADE   (GRRLIB_BLEND_MULTI)
 Alias for GRRLIB_BLEND_MULTI. More...
 
#define GRR_EXTERN   extern
 
#define GRR_INIT(v)
 
#define GRR_INITS(...)
 
#define INLINE   static inline
 

Typedefs

typedef unsigned int uint
 The uint keyword signifies an integral type. More...
 
typedef enum GRRLIB_blendMode GRRLIB_blendMode
 GRRLIB Blending Modes.
 
typedef struct GRRLIB_drawSettings GRRLIB_drawSettings
 Structure to hold the current drawing settings.
 
typedef struct GRRLIB_texImg GRRLIB_texImg
 Structure to hold the texture information.
 
typedef struct GRRLIB_bytemapChar GRRLIB_bytemapChar
 Structure to hold the bytemap character information.
 
typedef struct GRRLIB_bytemapFont GRRLIB_bytemapFont
 Structure to hold the bytemap font information.
 
typedef struct GRRLIB_Font GRRLIB_ttfFont
 Structure to hold the TTF information.
 

Enumerations

enum  GRRLIB_blendMode {
  GRRLIB_BLEND_ALPHA = 0, GRRLIB_BLEND_ADD = 1, GRRLIB_BLEND_SCREEN = 2, GRRLIB_BLEND_MULTI = 3,
  GRRLIB_BLEND_INV = 4
}
 GRRLIB Blending Modes. More...
 

Functions

GRR_EXTERN void *xfb[2] GRR_INITS (NULL, NULL)
 
GRR_EXTERN u32 fb GRR_INIT (0)
 
INLINE void GRRLIB_ClipReset (void)
 Reset the clipping to normal.
 
INLINE void GRRLIB_ClipDrawing (const int x, const int y, const int width, const int height)
 Clip the drawing area to an rectangle. More...
 
INLINE bool GRRLIB_PtInRect (const int hotx, const int hoty, const int hotw, const int hoth, const int wpadx, const int wpady)
 Determine whether the specified point lies within the specified rectangle. More...
 
INLINE bool GRRLIB_RectInRect (const int rect1x, const int rect1y, const int rect1w, const int rect1h, const int rect2x, const int rect2y, const int rect2w, const int rect2h)
 Determine whether a specified rectangle lies within another rectangle. More...
 
INLINE bool GRRLIB_RectOnRect (const int rect1x, const int rect1y, const int rect1w, const int rect1h, const int rect2x, const int rect2y, const int rect2w, const int rect2h)
 Determine whether a part of a specified rectangle lies on another rectangle. More...
 
INLINE void GRRLIB_NPlot (const guVector v[], const u32 color[], const long n)
 Draw an array of points. More...
 
INLINE void GRRLIB_NGone (const guVector v[], const u32 color[], const long n)
 Draw a polygon. More...
 
INLINE void GRRLIB_NGoneFilled (const guVector v[], const u32 color[], const long n)
 Draw a filled polygon. More...
 
INLINE void GRRLIB_GXEngine (const guVector v[], const u32 color[], const long n, const u8 fmt)
 Draws a vector. More...
 
INLINE void GRRLIB_FillScreen (const u32 color)
 Clear screen with a specific color. More...
 
INLINE void GRRLIB_Plot (const f32 x, const f32 y, const u32 color)
 Draw a dot. More...
 
INLINE void GRRLIB_Line (const f32 x1, const f32 y1, const f32 x2, const f32 y2, const u32 color)
 Draw a line. More...
 
INLINE void GRRLIB_Rectangle (const f32 x, const f32 y, const f32 width, const f32 height, const u32 color, const bool filled)
 Draw a rectangle. More...
 
INLINE void GRRLIB_SetHandle (GRRLIB_texImg *tex, const int x, const int y)
 Set a texture's X and Y handles. More...
 
INLINE void GRRLIB_SetMidHandle (GRRLIB_texImg *tex, const bool enabled)
 Center a texture's handles. More...
 
INLINE u32 GRRLIB_GetPixelFromtexImg (const int x, const int y, const GRRLIB_texImg *tex)
 Return the color value of a pixel from a GRRLIB_texImg. More...
 
INLINE void GRRLIB_SetPixelTotexImg (const int x, const int y, GRRLIB_texImg *tex, const u32 color)
 Set the color value of a pixel to a GRRLIB_texImg. More...
 
INLINE u32 GRRLIB_GetPixelFromFB (int x, int y)
 Reads a pixel directly from the FrontBuffer. More...
 
INLINE void GRRLIB_SetPixelToFB (int x, int y, u32 pokeColor)
 Writes a pixel directly from the FrontBuffer. More...
 
INLINE void GRRLIB_SetBlend (const GRRLIB_blendMode blendmode)
 Set a blending mode. More...
 
INLINE GRRLIB_blendMode GRRLIB_GetBlend (void)
 Get the current blending mode. More...
 
INLINE void GRRLIB_SetAntiAliasing (const bool aa)
 Turn anti-aliasing on/off. More...
 
INLINE bool GRRLIB_GetAntiAliasing (void)
 Get current anti-aliasing setting. More...
 
INLINE void GRRLIB_ClearTex (GRRLIB_texImg *tex)
 Clear a texture to transparent black. More...
 
INLINE void GRRLIB_FlushTex (GRRLIB_texImg *tex)
 Write the contents of a texture in the data cache down to main memory. More...
 
INLINE void GRRLIB_FreeTexture (GRRLIB_texImg *tex)
 Free memory allocated for texture. More...
 
GRRLIB_bytemapFontGRRLIB_LoadBMF (const u8 my_bmf[])
 Load a ByteMap font structure from a buffer. More...
 
void GRRLIB_FreeBMF (GRRLIB_bytemapFont *bmf)
 Free memory allocated by ByteMap fonts. More...
 
void GRRLIB_InitTileSet (GRRLIB_texImg *tex, const uint tilew, const uint tileh, const uint tilestart)
 Initialize a tile set. More...
 
void GRRLIB_BMFX_FlipH (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest)
 Flip texture horizontal. More...
 
void GRRLIB_BMFX_FlipV (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest)
 Flip texture vertical. More...
 
void GRRLIB_BMFX_Grayscale (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest)
 Change a texture to gray scale. More...
 
void GRRLIB_BMFX_Sepia (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest)
 Change a texture to sepia (old photo style). More...
 
void GRRLIB_BMFX_Invert (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest)
 Invert colors of the texture. More...
 
void GRRLIB_BMFX_Blur (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest, const u32 factor)
 A texture effect (Blur). More...
 
void GRRLIB_BMFX_Scatter (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest, const u32 factor)
 A texture effect (Scatter). More...
 
void GRRLIB_BMFX_Pixelate (const GRRLIB_texImg *texsrc, GRRLIB_texImg *texdest, const u32 factor)
 A texture effect (Pixelate). More...
 
int GRRLIB_Init (void)
 Initialize GRRLIB. More...
 
void GRRLIB_Exit (void)
 Call this before exiting your application. More...
 
void GRRLIB_Circle (const f32 x, const f32 y, const f32 radius, const u32 color, const u8 filled)
 Draw a circle. More...
 
int GRRLIB_LoadFile (const char *filename, unsigned char **data)
 Load a file to memory. More...
 
GRRLIB_texImgGRRLIB_LoadTextureFromFile (const char *filename)
 Load a texture from a file. More...
 
bool GRRLIB_ScrShot (const char *filename)
 Make a PNG screenshot. More...
 
void GRRLIB_Printf (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex, const u32 color, const f32 zoom, const char *text,...)
 Print formatted output. More...
 
void GRRLIB_PrintBMF (const f32 xpos, const f32 ypos, const GRRLIB_bytemapFont *bmf, const char *text,...)
 Print formatted output with a ByteMap font. More...
 
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. More...
 
void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex, const u32 color)
 Draw a textured quad. More...
 
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. More...
 
void GRRLIB_DrawPart (const f32 xpos, const f32 ypos, const f32 partx, const f32 party, const f32 partw, const f32 parth, const GRRLIB_texImg *tex, const f32 degrees, const f32 scaleX, const f32 scaleY, const u32 color)
 Draw a part of a texture. More...
 
void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex, const u32 color, const int frame)
 Draw a tile in a quad. More...
 
void GRRLIB_Render (void)
 Call this function after drawing.
 
void GRRLIB_Screen2Texture (int posx, int posy, GRRLIB_texImg *tex, bool clear)
 Make a snapshot of the screen in a texture WITHOUT ALPHA LAYER. More...
 
void GRRLIB_CompoStart (void)
 Start GX compositing process. More...
 
void GRRLIB_CompoEnd (int posx, int posy, GRRLIB_texImg *tex)
 End GX compositing process (Make a snapshot of the screen in a texture WITH ALPHA LAYER). More...
 
GRRLIB_texImgGRRLIB_CreateEmptyTexture (const uint w, const uint h)
 Create an empty texture. More...
 
GRRLIB_texImgGRRLIB_LoadTexture (const u8 *my_img)
 Load a texture from a buffer. More...
 
GRRLIB_texImgGRRLIB_LoadTexturePNG (const u8 *my_png)
 Load a texture from a buffer. More...
 
GRRLIB_texImgGRRLIB_LoadTextureJPG (const u8 *my_jpg)
 Load a texture from a buffer. More...
 
GRRLIB_texImgGRRLIB_LoadTextureJPGEx (const u8 *my_jpg, const int)
 Load a texture from a buffer. More...
 
GRRLIB_texImgGRRLIB_LoadTextureBMP (const u8 *my_bmp)
 Load a texture from a buffer. More...
 
bool GRRLIB_GeckoInit ()
 Initialize USB Gecko. More...
 
void GRRLIB_GeckoPrintf (const char *text,...)
 Print Gecko. More...
 
void GRRLIB_SetBackgroundColour (u8 r, u8 g, u8 b, u8 a)
 Set the background parameter when screen is cleared. More...
 
void GRRLIB_Camera3dSettings (f32 posx, f32 posy, f32 posz, f32 upx, f32 upy, f32 upz, f32 lookx, f32 looky, f32 lookz)
 Set the camera parameter (contributed my chris_c aka DaShAmAn). More...
 
void GRRLIB_3dMode (f32 minDist, f32 maxDist, f32 fov, bool texturemode, bool normalmode)
 Set up the position matrix (contributed by chris_c aka DaShAmAn). More...
 
void GRRLIB_2dMode ()
 Go back to 2D mode (contributed by chris_c aka DaShAmAn).
 
void GRRLIB_ObjectViewBegin (void)
 Init the object matrix to draw object.
 
void GRRLIB_ObjectViewScale (f32 scalx, f32 scaly, f32 scalz)
 Scale the object matrix to draw object. More...
 
void GRRLIB_ObjectViewRotate (f32 angx, f32 angy, f32 angz)
 Rotate the object matrix to draw object . More...
 
void GRRLIB_ObjectViewTrans (f32 posx, f32 posy, f32 posz)
 Translate the object matrix to draw object. More...
 
void GRRLIB_ObjectViewEnd (void)
 Concat the object and the view matrix and calculate the inverse normal matrix.
 
void GRRLIB_ObjectView (f32 posx, f32 posy, f32 posz, f32 angx, f32 angy, f32 angz, f32 scalx, f32 scaly, f32 scalz)
 Set the view matrix to draw object (in this order scale, rotate AND trans). More...
 
void GRRLIB_ObjectViewInv (f32 posx, f32 posy, f32 posz, f32 angx, f32 angy, f32 angz, f32 scalx, f32 scaly, f32 scalz)
 Set the view matrix to draw object (in this order scale, trans AND rotate). More...
 
void GRRLIB_SetTexture (GRRLIB_texImg *tex, bool rep)
 Set the texture to an object (contributed by chris_c aka DaShAmAn). More...
 
void GRRLIB_DrawTorus (f32 r, f32 R, int nsides, int rings, bool filled, u32 col)
 Draw a torus (with normal). More...
 
void GRRLIB_DrawSphere (f32 r, int lats, int longs, bool filled, u32 col)
 Draw a sphere (with normal). More...
 
void GRRLIB_DrawCube (f32 size, bool filled, u32 col)
 Draw a cube (with normal). More...
 
void GRRLIB_DrawCylinder (f32 r, f32 h, int d, bool filled, u32 col)
 Draw a cylinder (with normal). More...
 
void GRRLIB_DrawCone (f32 r, f32 h, int d, bool filled, u32 col)
 Draw a cone (with normal). More...
 
void GRRLIB_DrawTessPanel (f32 w, f32 wstep, f32 h, f32 hstep, bool filled, u32 col)
 Draw a Tesselated panel (with normal). More...
 
void GRRLIB_SetLightAmbient (u32 ambientcolor)
 Set ambient color. More...
 
void GRRLIB_SetLightDiff (u8 num, guVector pos, f32 distattn, f32 brightness, u32 lightcolor)
 Set diffuse light parameters. More...
 
void GRRLIB_SetLightSpec (u8 num, guVector dir, f32 shy, u32 lightcolor, u32 speccolor)
 Set specular light parameters. More...
 
void GRRLIB_SetLightSpot (u8 num, guVector pos, guVector lookat, f32 angAttn0, f32 angAttn1, f32 angAttn2, f32 distAttn0, f32 distAttn1, f32 distAttn2, u32 lightcolor)
 Set Spot light parameters. More...
 
void GRRLIB_SetLightOff (void)
 Set all lights off, like at init.
 
GRRLIB_ttfFontGRRLIB_LoadTTF (const u8 *file_base, s32 file_size)
 Load a TTF from a buffer. More...
 
void GRRLIB_FreeTTF (GRRLIB_ttfFont *myFont)
 Free memory allocated by TTF fonts. More...
 
void GRRLIB_PrintfTTF (int x, int y, GRRLIB_ttfFont *myFont, const char *string, unsigned int fontSize, const u32 color)
 Print function for TTF font. More...
 
void GRRLIB_PrintfTTFW (int x, int y, GRRLIB_ttfFont *myFont, const wchar_t *string, unsigned int fontSize, const u32 color)
 Print function for TTF font. More...
 
unsigned int GRRLIB_WidthTTF (GRRLIB_ttfFont *myFont, const char *, unsigned int)
 Get the width of a text in pixel. More...
 
unsigned int GRRLIB_WidthTTFW (GRRLIB_ttfFont *myFont, const wchar_t *, unsigned int)
 Get the width of a text in pixel. More...
 

Variables

GRR_EXTERN GXRModeObj * rmode
 

Detailed Description

This is the complete list of functions, structures, defines, typedefs, enumerations and variables you may want to used to make your homebrew with GRRLIB.

You simply need to include grrlib.h in your project to have access to all of these.

Macro Definition Documentation

#define A (   c)    ( (c) &0xFF)

Extract alpha component of colour.

#define B (   c)    (((c) >> 8) &0xFF)

Extract blue component of colour.

#define G (   c)    (((c) >>16) &0xFF)

Extract green component of colour.

#define GRRLIB_BLEND_LIGHT   (GRRLIB_BLEND_ADD)

Alias for GRRLIB_BLEND_ADD.

#define GRRLIB_BLEND_NONE   (GRRLIB_BLEND_ALPHA)

Alias for GRRLIB_BLEND_ALPHA.

#define GRRLIB_BLEND_SHADE   (GRRLIB_BLEND_MULTI)

Alias for GRRLIB_BLEND_MULTI.

#define R (   c)    (((c) >>24) &0xFF)

Extract red component of colour.

#define RGBA (   r,
  g,
  b,
 
)
Value:
( (u32)( ( ((u32)(r)) <<24) | \
((((u32)(g)) &0xFF) <<16) | \
((((u32)(b)) &0xFF) << 8) | \
( ((u32)(a)) &0xFF ) ) )

Build an RGB pixel from components.

Parameters
rRed component.
gGreen component.
bBlue component.
aAlpha component.

Typedef Documentation

typedef unsigned int uint

The uint keyword signifies an integral type.

Enumeration Type Documentation

GRRLIB Blending Modes.

Enumerator
GRRLIB_BLEND_ALPHA 

Alpha Blending.

GRRLIB_BLEND_ADD 

Additive Blending.

GRRLIB_BLEND_SCREEN 

Alpha Light Blending.

GRRLIB_BLEND_MULTI 

Multiply Blending.

GRRLIB_BLEND_INV 

Invert Color Blending.

Function Documentation

void GRRLIB_3dMode ( f32  minDist,
f32  maxDist,
f32  fov,
bool  texturemode,
bool  normalmode 
)

Set up the position matrix (contributed by chris_c aka DaShAmAn).

Parameters
minDistMinimal distance for the camera.
maxDistMaximal distance for the camera.
fovField of view for the camera.
texturemodeFalse, GX won't need texture coordinate, True, GX will need texture coordinate.
normalmodeFalse, GX won't need normal coordinate, True, GX will need normal coordinate.
void GRRLIB_BMFX_Blur ( const GRRLIB_texImg texsrc,
GRRLIB_texImg texdest,
const u32  factor 
)

A texture effect (Blur).

See Also
GRRLIB_FlushTex
Parameters
texsrcThe texture source.
texdestThe texture destination.
factorThe blur factor.
void GRRLIB_BMFX_FlipH ( const GRRLIB_texImg texsrc,
GRRLIB_texImg texdest 
)

Flip texture horizontal.

See Also
GRRLIB_FlushTex
Parameters
texsrcThe texture source.
texdestThe texture destination.
void GRRLIB_BMFX_FlipV ( const GRRLIB_texImg texsrc,
GRRLIB_texImg texdest 
)

Flip texture vertical.

See Also
GRRLIB_FlushTex
Parameters
texsrcThe texture source.
texdestThe texture destination.
void GRRLIB_BMFX_Grayscale ( const GRRLIB_texImg texsrc,
GRRLIB_texImg texdest 
)

Change a texture to gray scale.

See Also
GRRLIB_FlushTex
Parameters
texsrcThe texture source.
texdestThe texture grayscaled destination.
void GRRLIB_BMFX_Invert ( const GRRLIB_texImg texsrc,
GRRLIB_texImg texdest 
)

Invert colors of the texture.

See Also
GRRLIB_FlushTex
Parameters
texsrcThe texture source.
texdestThe 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
texsrcThe texture source.
texdestThe texture destination.
factorThe 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
texsrcThe texture source.
texdestThe texture destination.
factorThe 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
texsrcThe texture source.
texdestThe texture destination.
Author
elisherer
void GRRLIB_Camera3dSettings ( f32  posx,
f32  posy,
f32  posz,
f32  upx,
f32  upy,
f32  upz,
f32  lookx,
f32  looky,
f32  lookz 
)

Set the camera parameter (contributed my chris_c aka DaShAmAn).

Parameters
posxx position of the camera.
posyy position of the camera.
poszz position of the camera.
upxAlpha component.
upyAlpha component.
upzAlpha component.
lookxx up position of the camera.
lookyy up position of the camera.
lookzz up position of the camera.
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
xSpecifies the x-coordinate of the circle.
ySpecifies the y-coordinate of the circle.
radiusThe radius of the circle.
colorThe color of the circle in RGBA format.
filledSet to true to fill the circle.
INLINE void GRRLIB_ClearTex ( GRRLIB_texImg tex)

Clear a texture to transparent black.

Parameters
texTexture to clear.
INLINE void GRRLIB_ClipDrawing ( const int  x,
const int  y,
const int  width,
const int  height 
)

Clip the drawing area to an rectangle.

Parameters
xThe x-coordinate of the rectangle.
yThe y-coordinate of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
void GRRLIB_CompoEnd ( int  posx,
int  posy,
GRRLIB_texImg tex 
)

End GX compositing process (Make a snapshot of the screen in a texture WITH ALPHA LAYER).

EFB is cleared after this function.

See Also
GRRLIB_CompoStart
Parameters
posxtop left corner of the grabbed part.
posytop left corner of the grabbed part.
texA pointer to a texture representing the screen or NULL if an error occurs.
void GRRLIB_CompoStart ( void  )

Start GX compositing process.

See Also
GRRLIB_CompoEnd
GRRLIB_texImg* GRRLIB_CreateEmptyTexture ( const uint  w,
const uint  h 
)

Create an empty texture.

Parameters
wWidth of the new texture to create.
hHeight of the new texture to create.
Returns
A GRRLIB_texImg structure newly created.
void GRRLIB_DrawCone ( f32  r,
f32  h,
int  d,
bool  filled,
u32  col 
)

Draw a cone (with normal).

Parameters
rRadius of the cone.
hHigh of the cone.
dDensity of slice.
filledWired or not.
colColor of the cone.
void GRRLIB_DrawCube ( f32  size,
bool  filled,
u32  col 
)

Draw a cube (with normal).

Parameters
sizeSize of the cube edge.
filledWired or not.
colColor of the cube.
void GRRLIB_DrawCylinder ( f32  r,
f32  h,
int  d,
bool  filled,
u32  col 
)

Draw a cylinder (with normal).

Parameters
rRadius of the cylinder.
hHigh of the cylinder.
dDensity of slice.
filledWired or not.
colColor of the cylinder.
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
xposSpecifies the x-coordinate of the upper-left corner.
yposSpecifies the y-coordinate of the upper-left corner.
texThe texture to draw.
degreesAngle of rotation.
scaleXSpecifies the x-coordinate scale. -1 could be used for flipping the texture horizontally.
scaleYSpecifies the y-coordinate scale. -1 could be used for flipping the texture vertically.
colorColor in RGBA format.
void GRRLIB_DrawImgQuad ( const guVector  pos[4],
GRRLIB_texImg tex,
const u32  color 
)

Draw a textured quad.

Parameters
posVector array of the 4 points.
texThe texture to draw.
colorColor in RGBA format.
void GRRLIB_DrawPart ( const f32  xpos,
const f32  ypos,
const f32  partx,
const f32  party,
const f32  partw,
const f32  parth,
const GRRLIB_texImg tex,
const f32  degrees,
const f32  scaleX,
const f32  scaleY,
const u32  color 
)

Draw a part of a texture.

Parameters
xposSpecifies the x-coordinate of the upper-left corner.
yposSpecifies the y-coordinate of the upper-left corner.
partxSpecifies the x-coordinate of the upper-left corner in the texture.
partySpecifies the y-coordinate of the upper-left corner in the texture.
partwSpecifies the width in the texture.
parthSpecifies the height in the texture.
texThe texture containing the tile to draw.
degreesAngle of rotation.
scaleXSpecifies the x-coordinate scale. -1 could be used for flipping the texture horizontally.
scaleYSpecifies the y-coordinate scale. -1 could be used for flipping the texture vertically.
colorColor in RGBA format.
void GRRLIB_DrawSphere ( f32  r,
int  lats,
int  longs,
bool  filled,
u32  col 
)

Draw a sphere (with normal).

Parameters
rRadius of the sphere.
latsNumber of latitudes.
longsNumber of longitudes.
filledWired or not.
colColor of the sphere.
void GRRLIB_DrawTessPanel ( f32  w,
f32  wstep,
f32  h,
f32  hstep,
bool  filled,
u32  col 
)

Draw a Tesselated panel (with normal).

Parameters
wWidth of the panel.
wstepSize of width slices.
hHeight of the panel.
hstepSize the de height slices.
filledWired or not.
colColor 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
xposSpecifies the x-coordinate of the upper-left corner.
yposSpecifies the y-coordinate of the upper-left corner.
texThe texture containing the tile to draw.
degreesAngle of rotation.
scaleXSpecifies the x-coordinate scale. -1 could be used for flipping the texture horizontally.
scaleYSpecifies the y-coordinate scale. -1 could be used for flipping the texture vertically.
colorColor in RGBA format.
frameSpecifies 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
posVector array of the 4 points.
texThe texture to draw.
colorColor in RGBA format.
frameSpecifies the frame to draw.
void GRRLIB_DrawTorus ( f32  r,
f32  R,
int  nsides,
int  rings,
bool  filled,
u32  col 
)

Draw a torus (with normal).

Parameters
rRadius of the ring.
RRadius of the torus.
nsidesNumber of faces per ring.
ringsNumber of rings.
filledWired or not.
colColor of the torus.
void GRRLIB_Exit ( void  )

Call this before exiting your application.

Ensure this function is only ever called once and only if the setup function has been called.

INLINE void GRRLIB_FillScreen ( const u32  color)

Clear screen with a specific color.

Parameters
colorThe color to use to fill the screen.
INLINE void GRRLIB_FlushTex ( GRRLIB_texImg tex)

Write 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 main memory.

Parameters
texThe texture to flush.
void GRRLIB_FreeBMF ( GRRLIB_bytemapFont bmf)

Free memory allocated by ByteMap fonts.

If bmf is a null pointer, the function does nothing.

Note
This function does not change the value of bmf itself, hence it still points to the same (now invalid) location.
Parameters
bmfA GRRLIB_bytemapFont structure.
INLINE void GRRLIB_FreeTexture ( GRRLIB_texImg tex)

Free memory allocated for texture.

If tex is a null pointer, the function does nothing.

Note
This function does not change the value of tex itself, hence it still points to the same (now invalid) location.
Parameters
texA GRRLIB_texImg structure.
void GRRLIB_FreeTTF ( GRRLIB_ttfFont myFont)

Free memory allocated by TTF fonts.

If myFont is a null pointer, the function does nothing.

Note
This function does not change the value of myFont itself, hence it still points to the same (now invalid) location.
Parameters
myFontA TTF.
bool GRRLIB_GeckoInit ( )

Initialize USB Gecko.

Returns
bool true=everything worked, false=problems occurred.
void GRRLIB_GeckoPrintf ( const char *  text,
  ... 
)

Print Gecko.

Parameters
textText to print.
...Optional arguments.
INLINE bool GRRLIB_GetAntiAliasing ( void  )

Get current anti-aliasing setting.

Returns
True if anti-aliasing is enabled.
INLINE GRRLIB_blendMode GRRLIB_GetBlend ( void  )

Get the current blending mode.

Returns
The current blending mode.
INLINE u32 GRRLIB_GetPixelFromFB ( int  x,
int  y 
)

Reads a pixel directly from the FrontBuffer.

Parameters
xThe x-coordinate within the FB.
yThe y-coordinate within the FB.
Returns
The color of a pixel in RGBA format.
INLINE u32 GRRLIB_GetPixelFromtexImg ( const int  x,
const int  y,
const GRRLIB_texImg tex 
)

Return the color value of a pixel from a GRRLIB_texImg.

Parameters
xSpecifies the x-coordinate of the pixel in the texture.
ySpecifies the y-coordinate of the pixel in the texture.
texThe texture to get the color from.
Returns
The color of a pixel in RGBA format.
INLINE void GRRLIB_GXEngine ( const guVector  v[],
const u32  color[],
const long  n,
const u8  fmt 
)

Draws a vector.

Parameters
vThe vector to draw.
colorThe color of the vector in RGBA format.
nNumber of points in the vector.
fmtType of primitive.
int GRRLIB_Init ( void  )

Initialize GRRLIB.

Call this once at the beginning your code.

Returns
A integer representing a code:
  • 0 : The operation completed successfully.
  • -1 : Not enough memory is available to initialize GRRLIB.
  • -2 : Failed to add the fat device driver to the devoptab.
  • -3 : Failed to initialize the font engine.
See Also
GRRLIB_Exit
void GRRLIB_InitTileSet ( GRRLIB_texImg tex,
const uint  tilew,
const uint  tileh,
const uint  tilestart 
)

Initialize a tile set.

Parameters
texThe texture to initialize.
tilewWidth of the tile.
tilehHeight of the tile.
tilestartOffset for starting position (Used in fonts).
INLINE void GRRLIB_Line ( const f32  x1,
const f32  y1,
const f32  x2,
const f32  y2,
const u32  color 
)

Draw a line.

Parameters
x1Starting point for line for the x coordinate.
y1Starting point for line for the y coordinate.
x2Ending point for line for the x coordinate.
y2Ending point for line for the x coordinate.
colorLine color in RGBA format.
Author
JESPA
GRRLIB_bytemapFont* GRRLIB_LoadBMF ( const u8  my_bmf[])

Load a ByteMap font structure from a buffer.

File format version 1.1 is used, more information could be found at http://bmf.wz.cz/bmf-format.htm

Parameters
my_bmfThe ByteMap font buffer to load.
Returns
A GRRLIB_bytemapFont structure filled with BMF information.
See Also
GRRLIB_FreeBMF
int GRRLIB_LoadFile ( const char *  filename,
unsigned char **  data 
)

Load a file to memory.

Parameters
filenameName of the file to be loaded.
dataPointer-to-your-pointer. Ie. { u8 *data; GRRLIB_LoadFile("file", &data); }. It is your responsibility to free the memory allocated by this function.
Returns
A integer representing a code:
  • 0 : EmptyFile.
  • -1 : FileNotFound.
  • -2 : OutOfMemory.
  • -3 : FileReadError.
  • >0 : FileLength.
GRRLIB_texImg* GRRLIB_LoadTexture ( const u8 *  my_img)

Load a texture from a buffer.

Parameters
my_imgThe JPEG, PNG or Bitmap buffer to load.
Returns
A GRRLIB_texImg structure filled with image information.
GRRLIB_texImg* GRRLIB_LoadTextureBMP ( const u8 *  my_bmp)

Load a texture from a buffer.

It only works for the MS-Windows standard format uncompressed (1-bit, 4-bit, 8-bit, 24-bit and 32-bit).

Parameters
my_bmpthe Bitmap buffer to load.
Returns
A GRRLIB_texImg structure filled with image information.
GRRLIB_texImg* GRRLIB_LoadTextureFromFile ( const char *  filename)

Load a texture from a file.

Parameters
filenameThe JPEG, PNG or Bitmap filename to load.
Returns
A GRRLIB_texImg structure filled with image information. If an error occurs NULL will be returned.
GRRLIB_texImg* GRRLIB_LoadTextureJPG ( const u8 *  my_jpg)

Load a texture from a buffer.

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

Parameters
my_jpgThe JPEG buffer to load.
Returns
A GRRLIB_texImg structure filled with image information.
GRRLIB_texImg* GRRLIB_LoadTextureJPGEx ( const u8 *  my_jpg,
const int  my_size 
)

Load a texture from a buffer.

Author
DrTwox
Parameters
my_jpgThe JPEG buffer to load.
my_sizeSize of the JPEG buffer to load.
Returns
A GRRLIB_texImg structure filled with image information.
GRRLIB_texImg* GRRLIB_LoadTexturePNG ( const u8 *  my_png)

Load a texture from a buffer.

Parameters
my_pngthe PNG buffer to load.
Returns
A GRRLIB_texImg structure filled with image information. If image size is not correct, the texture will be completely transparent.
GRRLIB_ttfFont* GRRLIB_LoadTTF ( const u8 *  file_base,
s32  file_size 
)

Load a TTF from a buffer.

Parameters
file_baseBuffer with TTF data. You must not deallocate the memory before calling GRRLIB_FreeTTF.
file_sizeSize of the TTF buffer.
Returns
A handle to a given TTF font object or NULL if it fails to load the font.
See Also
GRRLIB_FreeTTF
INLINE void GRRLIB_NGone ( const guVector  v[],
const u32  color[],
const long  n 
)

Draw a polygon.

Parameters
vThe vector containing the coordinates of the polygon.
colorThe color of the filled polygon in RGBA format.
nNumber of points in the vector.
INLINE void GRRLIB_NGoneFilled ( const guVector  v[],
const u32  color[],
const long  n 
)

Draw a filled polygon.

Parameters
vThe vector containing the coordinates of the polygon.
colorThe color of the filled polygon in RGBA format.
nNumber of points in the vector.
INLINE void GRRLIB_NPlot ( const guVector  v[],
const u32  color[],
const long  n 
)

Draw an array of points.

Parameters
vArray containing the points.
colorThe color of the points in RGBA format.
nNumber of points in the vector array.
void GRRLIB_ObjectView ( f32  posx,
f32  posy,
f32  posz,
f32  angx,
f32  angy,
f32  angz,
f32  scalx,
f32  scaly,
f32  scalz 
)

Set the view matrix to draw object (in this order scale, rotate AND trans).

Parameters
posxx position of the object.
posyy position of the object.
poszz position of the object.
angxx rotation angle of the object.
angyy rotation angle of the object.
angzz rotation angle of the object.
scalxx scale of the object.
scalyy scale of the object.
scalzz scale of the object.
void GRRLIB_ObjectViewInv ( f32  posx,
f32  posy,
f32  posz,
f32  angx,
f32  angy,
f32  angz,
f32  scalx,
f32  scaly,
f32  scalz 
)

Set the view matrix to draw object (in this order scale, trans AND rotate).

Parameters
posxx position of the object.
posyy position of the object.
poszz position of the object.
angxx rotation angle of the object.
angyy rotation angle of the object.
angzz rotation angle of the object.
scalxx scale of the object.
scalyy scale of the object.
scalzz scale of the object.
void GRRLIB_ObjectViewRotate ( f32  angx,
f32  angy,
f32  angz 
)

Rotate the object matrix to draw object .

Parameters
angxx rotation angle of the object.
angyy rotation angle of the object.
angzz rotation angle of the object.
void GRRLIB_ObjectViewScale ( f32  scalx,
f32  scaly,
f32  scalz 
)

Scale the object matrix to draw object.

Parameters
scalxx scale of the object.
scalyy scale of the object.
scalzz scale of the object.
void GRRLIB_ObjectViewTrans ( f32  posx,
f32  posy,
f32  posz 
)

Translate the object matrix to draw object.

Parameters
posxx position of the object.
posyy position of the object.
poszz position of the object.
INLINE void GRRLIB_Plot ( const f32  x,
const f32  y,
const u32  color 
)

Draw a dot.

Parameters
xSpecifies the x-coordinate of the dot.
ySpecifies the y-coordinate of the dot.
colorThe color of the dot in RGBA format.
Author
Jespa
void GRRLIB_PrintBMF ( const f32  xpos,
const f32  ypos,
const GRRLIB_bytemapFont bmf,
const char *  text,
  ... 
)

Print formatted output with a ByteMap font.

This function could be slow, it should be used with GRRLIB_CompoStart and GRRLIB_CompoEnd.

Parameters
xposSpecifies the x-coordinate of the upper-left corner of the text.
yposSpecifies the y-coordinate of the upper-left corner of the text.
bmfThe ByteMap font to use.
textText 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,
  ... 
)

Print formatted output.

Parameters
xposSpecifies the x-coordinate of the upper-left corner of the text.
yposSpecifies the y-coordinate of the upper-left corner of the text.
texThe texture containing the character set.
colorText color in RGBA format. The alpha channel is used to change the opacity of the text.
zoomThis is a factor by which the text size will be increase or decrease.
textText to draw.
...Optional arguments.
void GRRLIB_PrintfTTF ( int  x,
int  y,
GRRLIB_ttfFont myFont,
const char *  string,
unsigned int  fontSize,
const u32  color 
)

Print function for TTF font.

Parameters
xSpecifies the x-coordinate of the upper-left corner of the text.
ySpecifies the y-coordinate of the upper-left corner of the text.
myFontA TTF.
stringText to draw.
fontSizeSize of the font.
colorText color in RGBA format.
void GRRLIB_PrintfTTFW ( int  x,
int  y,
GRRLIB_ttfFont myFont,
const wchar_t *  utf32,
unsigned int  fontSize,
const u32  color 
)

Print function for TTF font.

Author
wplaat and DrTwox
Parameters
xSpecifies the x-coordinate of the upper-left corner of the text.
ySpecifies the y-coordinate of the upper-left corner of the text.
myFontA TTF.
utf32Text to draw.
fontSizeSize of the font.
colorText color in RGBA format.
INLINE bool GRRLIB_PtInRect ( const int  hotx,
const int  hoty,
const int  hotw,
const int  hoth,
const int  wpadx,
const int  wpady 
)

Determine whether the specified point lies within the specified rectangle.

Parameters
hotxSpecifies the x-coordinate of the upper-left corner of the rectangle.
hotySpecifies the y-coordinate of the upper-left corner of the rectangle.
hotwThe width of the rectangle.
hothThe height of the rectangle.
wpadxSpecifies the x-coordinate of the point.
wpadySpecifies the y-coordinate of the point.
Returns
If the specified point lies within the rectangle, the return value is true otherwise it's false.
INLINE void GRRLIB_Rectangle ( const f32  x,
const f32  y,
const f32  width,
const f32  height,
const u32  color,
const bool  filled 
)

Draw a rectangle.

Parameters
xSpecifies the x-coordinate of the upper-left corner of the rectangle.
ySpecifies the y-coordinate of the upper-left corner of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
colorThe color of the rectangle in RGBA format.
filledSet to true to fill the rectangle.
INLINE bool GRRLIB_RectInRect ( const int  rect1x,
const int  rect1y,
const int  rect1w,
const int  rect1h,
const int  rect2x,
const int  rect2y,
const int  rect2w,
const int  rect2h 
)

Determine whether a specified rectangle lies within another rectangle.

Parameters
rect1xSpecifies the x-coordinate of the upper-left corner of the rectangle.
rect1ySpecifies the y-coordinate of the upper-left corner of the rectangle.
rect1wSpecifies the width of the rectangle.
rect1hSpecifies the height of the rectangle.
rect2xSpecifies the x-coordinate of the upper-left corner of the rectangle.
rect2ySpecifies the y-coordinate of the upper-left corner of the rectangle.
rect2wSpecifies the width of the rectangle.
rect2hSpecifies the height of the rectangle.
Returns
If the specified rectangle lies within the other rectangle, the return value is true otherwise it's false.
INLINE bool GRRLIB_RectOnRect ( const int  rect1x,
const int  rect1y,
const int  rect1w,
const int  rect1h,
const int  rect2x,
const int  rect2y,
const int  rect2w,
const int  rect2h 
)

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

Parameters
rect1xSpecifies the x-coordinate of the upper-left corner of the first rectangle.
rect1ySpecifies the y-coordinate of the upper-left corner of the first rectangle.
rect1wSpecifies the width of the first rectangle.
rect1hSpecifies the height of the first rectangle.
rect2xSpecifies the x-coordinate of the upper-left corner of the second rectangle.
rect2ySpecifies the y-coordinate of the upper-left corner of the second rectangle.
rect2wSpecifies the width of the second rectangle.
rect2hSpecifies 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_Screen2Texture ( int  posx,
int  posy,
GRRLIB_texImg tex,
bool  clear 
)

Make a snapshot of the screen in a texture WITHOUT ALPHA LAYER.

Parameters
posxtop left corner of the grabbed part.
posytop left corner of the grabbed part.
texA pointer to a texture representing the screen or NULL if an error occurs.
clearWhen this flag is set to true, the screen is cleared after copy.
bool GRRLIB_ScrShot ( const char *  filename)

Make a PNG screenshot.

It should be called after drawing stuff on the screen, but before GRRLIB_Render. libfat is required to use the function.

Parameters
filenameName of the file to write.
Returns
bool true=everything worked, false=problems occurred.
INLINE void GRRLIB_SetAntiAliasing ( const bool  aa)

Turn anti-aliasing on/off.

Parameters
aaSet to true to enable anti-aliasing (Default: Enabled).
void GRRLIB_SetBackgroundColour ( u8  r,
u8  g,
u8  b,
u8  a 
)

Set the background parameter when screen is cleared.

Parameters
rRed component.
gGreen component.
bBlue component.
aAlpha component.
INLINE void GRRLIB_SetBlend ( const GRRLIB_blendMode  blendmode)

Set a blending mode.

Parameters
blendmodeThe blending mode to use (Default: GRRLIB_BLEND_ALPHA).
INLINE void GRRLIB_SetHandle ( GRRLIB_texImg tex,
const int  x,
const int  y 
)

Set a texture's X and Y handles.

For example, it could be used for the rotation of a texture.

Parameters
texThe texture to set the handle on.
xThe x-coordinate of the handle.
yThe y-coordinate of the handle.
void GRRLIB_SetLightAmbient ( u32  ambientcolor)

Set ambient color.

When no diffuse light is shining on a object, the color is equal to ambient color.

Parameters
ambientcolorAmbient color in RGBA format.
void GRRLIB_SetLightDiff ( u8  num,
guVector  pos,
f32  distattn,
f32  brightness,
u32  lightcolor 
)

Set diffuse light parameters.

Parameters
numNumber of the light. It's a number from 0 to 7.
posPosition of the diffuse light (x/y/z).
distattnDistance attenuation.
brightnessBrightness of the light. The value should be between 0 and 1.
lightcolorColor of the light in RGBA format.
void GRRLIB_SetLightSpec ( u8  num,
guVector  dir,
f32  shy,
u32  lightcolor,
u32  speccolor 
)

Set specular light parameters.

Parameters
numNumber of the light. It's a number from 0 to 7.
dirDirection of the specular ray (x/y/z).
shyShyniness of the specular. ( between 4 and 254)
lightcolorColor of the light in RGBA format.
speccolorSpecular color in RGBA format..
void GRRLIB_SetLightSpot ( u8  num,
guVector  pos,
guVector  lookat,
f32  angAttn0,
f32  angAttn1,
f32  angAttn2,
f32  distAttn0,
f32  distAttn1,
f32  distAttn2,
u32  lightcolor 
)

Set Spot light parameters.

Parameters
numNumber of the light. It's a number from 0 to 7.
posPosition of the spot light (x/y/z).
lookatWhere spot light look at (x/y/z).
angAttn0cone attenuation factor 0.
angAttn1cone attenuation factor 1.
angAttn2cone attenuation factor 2.
distAttn0Distance attenuation factor 0.
distAttn1Distance attenuation factor 1.
distAttn2Distance attenuation factor 2.
lightcolorColor of the light in RGBA format.
INLINE void GRRLIB_SetMidHandle ( GRRLIB_texImg tex,
const bool  enabled 
)

Center a texture's handles.

For example, it could be used for the rotation of a texture.

Parameters
texThe texture to center.
enabled
INLINE void GRRLIB_SetPixelToFB ( int  x,
int  y,
u32  pokeColor 
)

Writes a pixel directly from the FrontBuffer.

Parameters
xThe x-coordinate within the FB.
yThe y-coordinate within the FB.
pokeColorThe color of the pixel in RGBA format.
INLINE void GRRLIB_SetPixelTotexImg ( const int  x,
const int  y,
GRRLIB_texImg tex,
const u32  color 
)

Set the color value of a pixel to a GRRLIB_texImg.

See Also
GRRLIB_FlushTex
Parameters
xSpecifies the x-coordinate of the pixel in the texture.
ySpecifies the y-coordinate of the pixel in the texture.
texThe texture to set the color to.
colorThe color of the pixel in RGBA format.
void GRRLIB_SetTexture ( GRRLIB_texImg tex,
bool  rep 
)

Set the texture to an object (contributed by chris_c aka DaShAmAn).

Parameters
texPointer to an image texture (GRRLIB_texImg format).
repTexture Repeat Mode, True will repeat it, False won't.
unsigned int GRRLIB_WidthTTF ( GRRLIB_ttfFont myFont,
const char *  string,
unsigned int  fontSize 
)

Get the width of a text in pixel.

Parameters
myFontA TTF.
stringThe text to check.
fontSizeThe size of the font.
Returns
The width of a text in pixel.
unsigned int GRRLIB_WidthTTFW ( GRRLIB_ttfFont myFont,
const wchar_t *  utf32,
unsigned int  fontSize 
)

Get the width of a text in pixel.

Parameters
myFontA TTF.
utf32The text to check.
fontSizeThe size of the font.
Returns
The width of a text in pixel.