GRRLIB
4.4.1
|
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. 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.4.1" |
Version information for GRRLIB. | |
#define | R(c) (((c) >>24) &0xFF) |
Extract red component of colour. | |
#define | G(c) (((c) >>16) &0xFF) |
Extract green component of colour. | |
#define | B(c) (((c) >> 8) &0xFF) |
Extract blue component of colour. | |
#define | A(c) ( (c) &0xFF) |
Extract alpha component of colour. | |
#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. | |
#define | GRRLIB_BLEND_LIGHT (GRRLIB_BLEND_ADD) |
Alias for GRRLIB_BLEND_ADD. | |
#define | GRRLIB_BLEND_SHADE (GRRLIB_BLEND_MULTI) |
Alias for GRRLIB_BLEND_MULTI. | |
#define | GRR_EXTERN extern |
#define | GRR_INIT(v) |
#define | GRR_INITS(...) |
#define | INLINE static inline |
Typedefs | |
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_bytemapFont * | GRRLIB_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 u32 tilew, const u32 tileh, const u32 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, u8 **data) |
Load a file to memory. More... | |
GRRLIB_texImg * | GRRLIB_LoadTextureFromFile (const char *filename) |
Load a texture from a file. More... | |
GRRLIB_ttfFont * | GRRLIB_LoadTTFFromFile (const char *filename) |
Load a TTF 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_texImg * | GRRLIB_CreateEmptyTexture (const u32 w, const u32 h) |
Create an empty texture. More... | |
GRRLIB_texImg * | GRRLIB_LoadTexture (const u8 *my_img) |
Load a texture from a buffer. More... | |
GRRLIB_texImg * | GRRLIB_LoadTexturePNG (const u8 *my_png) |
Load a texture from a buffer. More... | |
GRRLIB_texImg * | GRRLIB_LoadTextureJPG (const u8 *my_jpg) |
Load a texture from a buffer. More... | |
GRRLIB_texImg * | GRRLIB_LoadTextureJPGEx (const u8 *my_jpg, const int) |
Load a texture from a buffer. More... | |
GRRLIB_texImg * | GRRLIB_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 by 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 shininess, 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_ttfFont * | GRRLIB_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... | |
u32 | GRRLIB_WidthTTF (GRRLIB_ttfFont *myFont, const char *, unsigned int) |
Get the width of a text in pixel. More... | |
u32 | GRRLIB_WidthTTFW (GRRLIB_ttfFont *myFont, const wchar_t *, unsigned int) |
Get the width of a text in pixel. More... | |
Variables | |
GRR_EXTERN GXRModeObj * | rmode |
Video mode. | |
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.
#define RGBA | ( | r, | |
g, | |||
b, | |||
a | |||
) |
Build an RGB pixel from components.
r | Red component. |
g | Green component. |
b | Blue component. |
a | Alpha component. |
enum GRRLIB_blendMode |
void GRRLIB_3dMode | ( | f32 | minDist, |
f32 | maxDist, | ||
f32 | fov, | ||
bool | texturemode, | ||
bool | normalmode | ||
) |
Set up the position matrix (contributed by chris_c aka DaShAmAn).
minDist | Minimal distance for the camera. |
maxDist | Maximal distance for the camera. |
fov | Field of view for the camera. |
texturemode | False, GX won't need texture coordinate, True, GX will need texture coordinate. |
normalmode | False, 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).
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_Camera3dSettings | ( | f32 | posx, |
f32 | posy, | ||
f32 | posz, | ||
f32 | upx, | ||
f32 | upy, | ||
f32 | upz, | ||
f32 | lookx, | ||
f32 | looky, | ||
f32 | lookz | ||
) |
Set the camera parameter (contributed by chris_c aka DaShAmAn).
posx | x position of the camera. |
posy | y position of the camera. |
posz | z position of the camera. |
upx | x up position of the camera. |
upy | y up position of the camera. |
upz | z up position of the camera. |
lookx | x position of the target. |
looky | y position of the target. |
lookz | z position of the target. |
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. |
INLINE void GRRLIB_ClearTex | ( | GRRLIB_texImg * | tex | ) |
Clear a texture to transparent black.
tex | Texture 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.
x | The x-coordinate of the rectangle. |
y | The y-coordinate of the rectangle. |
width | The width of the rectangle. |
height | The 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.
posx | top left corner of the grabbed part. |
posy | top left corner of the grabbed part. |
tex | A pointer to a texture representing the screen or NULL if an error occurs. |
void GRRLIB_CompoStart | ( | void | ) |
Start GX compositing process.
GRRLIB_texImg* GRRLIB_CreateEmptyTexture | ( | const u32 | w, |
const u32 | h | ||
) |
Create an empty texture.
w | Width of the new texture to create. |
h | Height of the new texture to create. |
void GRRLIB_DrawCone | ( | f32 | r, |
f32 | h, | ||
int | d, | ||
bool | filled, | ||
u32 | col | ||
) |
Draw a cone (with normal).
r | Radius of the cone. |
h | High of the cone. |
d | Density of slice. |
filled | Wired or not. |
col | Color of the cone. |
void GRRLIB_DrawCube | ( | f32 | size, |
bool | filled, | ||
u32 | col | ||
) |
Draw a cube (with normal).
size | Size of the cube edge. |
filled | Wired or not. |
col | Color of the cube. |
void GRRLIB_DrawCylinder | ( | f32 | r, |
f32 | h, | ||
int | d, | ||
bool | filled, | ||
u32 | col | ||
) |
Draw a cylinder (with normal).
r | Radius of the cylinder. |
h | High of the cylinder. |
d | Density of slice. |
filled | Wired or not. |
col | Color 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.
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_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.
xpos | Specifies the x-coordinate of the upper-left corner. |
ypos | Specifies the y-coordinate of the upper-left corner. |
partx | Specifies the x-coordinate of the upper-left corner in the texture. |
party | Specifies the y-coordinate of the upper-left corner in the texture. |
partw | Specifies the width in the texture. |
parth | Specifies the height in the texture. |
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. |
void GRRLIB_DrawSphere | ( | f32 | r, |
int | lats, | ||
int | longs, | ||
bool | filled, | ||
u32 | col | ||
) |
Draw a sphere (with normal).
r | Radius of the sphere. |
lats | Number of latitudes. |
longs | Number of longitudes. |
filled | Wired or not. |
col | Color of the sphere. |
void GRRLIB_DrawTessPanel | ( | f32 | w, |
f32 | wstep, | ||
f32 | h, | ||
f32 | hstep, | ||
bool | filled, | ||
u32 | col | ||
) |
Draw a Tesselated panel (with normal).
w | Width of the panel. |
wstep | Size of width slices. |
h | Height of the panel. |
hstep | Size the de height slices. |
filled | Wired or not. |
col | 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_DrawTorus | ( | f32 | r, |
f32 | R, | ||
int | nsides, | ||
int | rings, | ||
bool | filled, | ||
u32 | col | ||
) |
Draw a torus (with normal).
r | Radius of the ring. |
R | Radius of the torus. |
nsides | Number of faces per ring. |
rings | Number of rings. |
filled | Wired or not. |
col | Color 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.
color | The 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.
tex | The 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.
bmf | A 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.
tex | A 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.
myFont | A TTF. |
bool GRRLIB_GeckoInit | ( | ) |
Initialize USB Gecko.
void GRRLIB_GeckoPrintf | ( | const char * | text, |
... | |||
) |
Print Gecko.
text | Text to print. |
... | Optional arguments. |
INLINE bool GRRLIB_GetAntiAliasing | ( | void | ) |
Get current anti-aliasing setting.
INLINE GRRLIB_blendMode GRRLIB_GetBlend | ( | void | ) |
Get the current blending mode.
INLINE u32 GRRLIB_GetPixelFromFB | ( | int | x, |
int | y | ||
) |
Reads a pixel directly from the FrontBuffer.
x | The x-coordinate within the FB. |
y | The y-coordinate within the FB. |
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.
x | Specifies the x-coordinate of the pixel in the texture. |
y | Specifies the y-coordinate of the pixel in the texture. |
tex | The texture to get the color from. |
INLINE void GRRLIB_GXEngine | ( | const guVector | v[], |
const u32 | color[], | ||
const long | n, | ||
const u8 | fmt | ||
) |
Draws a vector.
v | The vector to draw. |
color | The color of the vector in RGBA format. |
n | Number of points in the vector. |
fmt | Type of primitive. |
int GRRLIB_Init | ( | void | ) |
Initialize GRRLIB.
Call this once at the beginning your code.
void GRRLIB_InitTileSet | ( | GRRLIB_texImg * | tex, |
const u32 | tilew, | ||
const u32 | tileh, | ||
const u32 | 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). |
INLINE void GRRLIB_Line | ( | const f32 | x1, |
const f32 | y1, | ||
const f32 | x2, | ||
const f32 | y2, | ||
const u32 | color | ||
) |
Draw a line.
x1 | Starting point for line for the x coordinate. |
y1 | Starting point for line for the y coordinate. |
x2 | Ending point for line for the x coordinate. |
y2 | Ending point for line for the x coordinate. |
color | Line color in RGBA format. |
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 https://bmf.php5.cz/?page=format
my_bmf | The ByteMap font buffer to load. |
int GRRLIB_LoadFile | ( | const char * | filename, |
u8 ** | data | ||
) |
Load a file to memory.
filename | Name of the file to be loaded. |
data | Pointer-to-your-pointer. Ie. { u8 *data; GRRLIB_LoadFile("file", &data); }. It is your responsibility to free the memory allocated by this function. |
GRRLIB_texImg* GRRLIB_LoadTexture | ( | const u8 * | my_img | ) |
Load a texture from a buffer.
my_img | The JPEG, PNG or Bitmap buffer to load. |
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).
my_bmp | the Bitmap buffer to load. |
GRRLIB_texImg* GRRLIB_LoadTextureFromFile | ( | const char * | filename | ) |
Load a texture from a file.
filename | The JPEG, PNG or Bitmap filename to load. |
GRRLIB_texImg* GRRLIB_LoadTextureJPG | ( | const u8 * | my_jpg | ) |
Load a texture from a buffer.
Take care to have the JPG finish with 0xFF 0xD9!
my_jpg | The JPEG buffer to load. |
GRRLIB_texImg* GRRLIB_LoadTextureJPGEx | ( | const u8 * | my_jpg, |
const int | my_size | ||
) |
Load a texture from a buffer.
my_jpg | The JPEG buffer to load. |
my_size | Size of 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. |
GRRLIB_ttfFont* GRRLIB_LoadTTF | ( | const u8 * | file_base, |
s32 | file_size | ||
) |
Load a TTF from a buffer.
file_base | Buffer with TTF data. You must not deallocate the memory before calling GRRLIB_FreeTTF. |
file_size | Size of the TTF buffer. |
GRRLIB_ttfFont* GRRLIB_LoadTTFFromFile | ( | const char * | filename | ) |
Load a TTF from a file.
filename | The TTF filename to load. |
INLINE void GRRLIB_NGone | ( | const guVector | v[], |
const u32 | color[], | ||
const long | n | ||
) |
Draw a polygon.
v | The vector containing the coordinates of the polygon. |
color | The color of the filled polygon in RGBA format. |
n | Number of points in the vector. |
INLINE void GRRLIB_NGoneFilled | ( | const guVector | v[], |
const u32 | color[], | ||
const long | n | ||
) |
Draw a filled polygon.
v | The vector containing the coordinates of the polygon. |
color | The color of the filled polygon in RGBA format. |
n | Number of points in the vector. |
INLINE void GRRLIB_NPlot | ( | const guVector | v[], |
const u32 | color[], | ||
const long | n | ||
) |
Draw an array of points.
v | Array containing the points. |
color | The color of the points in RGBA format. |
n | Number 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).
posx | x position of the object. |
posy | y position of the object. |
posz | z position of the object. |
angx | x rotation angle of the object. |
angy | y rotation angle of the object. |
angz | z rotation angle of the object. |
scalx | x scale of the object. |
scaly | y scale of the object. |
scalz | z 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).
posx | x position of the object. |
posy | y position of the object. |
posz | z position of the object. |
angx | x rotation angle of the object. |
angy | y rotation angle of the object. |
angz | z rotation angle of the object. |
scalx | x scale of the object. |
scaly | y scale of the object. |
scalz | z scale of the object. |
void GRRLIB_ObjectViewRotate | ( | f32 | angx, |
f32 | angy, | ||
f32 | angz | ||
) |
Rotate the object matrix to draw object.
angx | x rotation angle of the object. |
angy | y rotation angle of the object. |
angz | z rotation angle of the object. |
void GRRLIB_ObjectViewScale | ( | f32 | scalx, |
f32 | scaly, | ||
f32 | scalz | ||
) |
Scale the object matrix to draw object.
scalx | x scale of the object. |
scaly | y scale of the object. |
scalz | z scale of the object. |
void GRRLIB_ObjectViewTrans | ( | f32 | posx, |
f32 | posy, | ||
f32 | posz | ||
) |
Translate the object matrix to draw object.
posx | x position of the object. |
posy | y position of the object. |
posz | z position of the object. |
INLINE void GRRLIB_Plot | ( | const f32 | x, |
const f32 | y, | ||
const u32 | color | ||
) |
Draw a dot.
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 | ( | 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.
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. |
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, | ||
... | |||
) |
Print formatted output.
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_PrintfTTF | ( | int | x, |
int | y, | ||
GRRLIB_ttfFont * | myFont, | ||
const char * | string, | ||
unsigned int | fontSize, | ||
const u32 | color | ||
) |
Print function for TTF font.
x | Specifies the x-coordinate of the upper-left corner of the text. |
y | Specifies the y-coordinate of the upper-left corner of the text. |
myFont | A TTF. |
string | Text to draw. |
fontSize | Size of the font. |
color | Text 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.
x | Specifies the x-coordinate of the upper-left corner of the text. |
y | Specifies the y-coordinate of the upper-left corner of the text. |
myFont | A TTF. |
utf32 | Text to draw. |
fontSize | Size of the font. |
color | Text 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.
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. |
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.
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 | Set 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.
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. |
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.
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. |
void GRRLIB_Screen2Texture | ( | int | posx, |
int | posy, | ||
GRRLIB_texImg * | tex, | ||
bool | clear | ||
) |
Make a snapshot of the screen in a texture WITHOUT ALPHA LAYER.
posx | top left corner of the grabbed part. |
posy | top left corner of the grabbed part. |
tex | A pointer to a texture representing the screen or NULL if an error occurs. |
clear | When 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.
filename | Name of the file to write. |
INLINE void GRRLIB_SetAntiAliasing | ( | const bool | aa | ) |
Turn anti-aliasing on/off.
aa | Set 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.
r | Red component. |
g | Green component. |
b | Blue component. |
a | Alpha component. |
INLINE void GRRLIB_SetBlend | ( | const GRRLIB_blendMode | blendmode | ) |
Set a blending mode.
blendmode | The 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.
tex | The texture to set the handle on. |
x | The x-coordinate of the handle. |
y | The 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.
ambientcolor | Ambient color in RGBA format. |
void GRRLIB_SetLightDiff | ( | u8 | num, |
guVector | pos, | ||
f32 | distattn, | ||
f32 | brightness, | ||
u32 | lightcolor | ||
) |
Set diffuse light parameters.
num | Number of the light. It's a number from 0 to 7. |
pos | Position of the diffuse light (x/y/z). |
distattn | Distance attenuation. |
brightness | Brightness of the light. The value should be between 0 and 1. |
lightcolor | Color of the light in RGBA format. |
void GRRLIB_SetLightSpec | ( | u8 | num, |
guVector | dir, | ||
f32 | shininess, | ||
u32 | lightcolor, | ||
u32 | speccolor | ||
) |
Set specular light parameters.
num | Number of the light. It's a number from 0 to 7. |
dir | Direction of the specular ray (x/y/z). |
shininess | Shininess of the specular. ( between 4 and 254) |
lightcolor | Color of the light in RGBA format. |
speccolor | Specular 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.
num | Number of the light. It's a number from 0 to 7. |
pos | Position of the spot light (x/y/z). |
lookat | Where spot light look at (x/y/z). |
angAttn0 | cone attenuation factor 0. |
angAttn1 | cone attenuation factor 1. |
angAttn2 | cone attenuation factor 2. |
distAttn0 | Distance attenuation factor 0. |
distAttn1 | Distance attenuation factor 1. |
distAttn2 | Distance attenuation factor 2. |
lightcolor | Color 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.
tex | The texture to center. |
enabled |
INLINE void GRRLIB_SetPixelToFB | ( | int | x, |
int | y, | ||
u32 | pokeColor | ||
) |
Writes a pixel directly from the FrontBuffer.
x | The x-coordinate within the FB. |
y | The y-coordinate within the FB. |
pokeColor | The 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.
x | Specifies the x-coordinate of the pixel in the texture. |
y | Specifies the y-coordinate of the pixel in the texture. |
tex | The texture to set the color to. |
color | The 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).
tex | Pointer to an image texture (GRRLIB_texImg format). |
rep | Texture Repeat Mode, True will repeat it, False won't. |
u32 GRRLIB_WidthTTF | ( | GRRLIB_ttfFont * | myFont, |
const char * | string, | ||
unsigned int | fontSize | ||
) |
Get the width of a text in pixel.
myFont | A TTF. |
string | The text to check. |
fontSize | The size of the font. |
u32 GRRLIB_WidthTTFW | ( | GRRLIB_ttfFont * | myFont, |
const wchar_t * | utf32, | ||
unsigned int | fontSize | ||
) |
Get the width of a text in pixel.
myFont | A TTF. |
utf32 | The text to check. |
fontSize | The size of the font. |