[CHG] Cleaning code, I replaced all " ;" with ";"

This commit is contained in:
Crayon2000 2010-01-08 23:00:07 +00:00
parent 14bdb68481
commit 3a88515815
14 changed files with 105 additions and 105 deletions

View file

@ -149,7 +149,7 @@ void GRRLIB_2dMode() {
*/ */
void GRRLIB_ObjectView(f32 posx, f32 posy, f32 posz, f32 angx, f32 angy, f32 angz, f32 scalx, f32 scaly, f32 scalz) { void GRRLIB_ObjectView(f32 posx, f32 posy, f32 posz, f32 angx, f32 angy, f32 angz, f32 scalx, f32 scaly, f32 scalz) {
Mtx m, m1, mv, rx, ry, rz; Mtx m, m1, mv, rx, ry, rz;
Mtx mvi ; Mtx mvi;
guMtxIdentity(m1); guMtxIdentity(m1);
guMtxScaleApply(m1, m1, scalx, scaly, scalz); guMtxScaleApply(m1, m1, scalx, scaly, scalz);

View file

@ -51,14 +51,14 @@ int GRRLIB_Init (void) {
s8 error_code = 0; s8 error_code = 0;
// Ensure this function is only ever called once // Ensure this function is only ever called once
if (is_setup) return 0 ; if (is_setup) return 0;
// Initialise the video subsystem // Initialise the video subsystem
VIDEO_Init(); VIDEO_Init();
VIDEO_SetBlack(true); // Disable video output during initialisation VIDEO_SetBlack(true); // Disable video output during initialisation
// Grab a pointer to the video mode attributes // Grab a pointer to the video mode attributes
if ( !(rmode = VIDEO_GetPreferredMode(NULL)) ) return -1 ; if ( !(rmode = VIDEO_GetPreferredMode(NULL)) ) return -1;
// Video Mode Correction // Video Mode Correction
switch (rmode->viTVMode) { switch (rmode->viTVMode) {
@ -81,26 +81,26 @@ int GRRLIB_Init (void) {
VIDEO_Configure(rmode); VIDEO_Configure(rmode);
// Get some memory to use for a "double buffered" frame buffer // Get some memory to use for a "double buffered" frame buffer
if ( !(xfb[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode))) ) return -1 ; if ( !(xfb[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode))) ) return -1;
if ( !(xfb[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode))) ) return -1 ; if ( !(xfb[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode))) ) return -1;
VIDEO_SetNextFramebuffer(xfb[fb]); // Choose a frame buffer to start with VIDEO_SetNextFramebuffer(xfb[fb]); // Choose a frame buffer to start with
VIDEO_Flush(); // flush the frame to the TV VIDEO_Flush(); // flush the frame to the TV
VIDEO_WaitVSync(); // Wait for the TV to finish updating VIDEO_WaitVSync(); // Wait for the TV to finish updating
// If the TV image is interlaced it takes two passes to display the image // If the TV image is interlaced it takes two passes to display the image
if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync() ; if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();
// The FIFO is the buffer the CPU uses to send commands to the GPU // The FIFO is the buffer the CPU uses to send commands to the GPU
if ( !(gp_fifo = memalign(32, DEFAULT_FIFO_SIZE)) ) return -1 ; if ( !(gp_fifo = memalign(32, DEFAULT_FIFO_SIZE)) ) return -1;
memset(gp_fifo, 0, DEFAULT_FIFO_SIZE); memset(gp_fifo, 0, DEFAULT_FIFO_SIZE);
GX_Init(gp_fifo, DEFAULT_FIFO_SIZE); GX_Init(gp_fifo, DEFAULT_FIFO_SIZE);
// Clear the background to opaque black and clears the z-buffer // Clear the background to opaque black and clears the z-buffer
GX_SetCopyClear((GXColor){ 0, 0, 0, 0 }, GX_MAX_Z24); GX_SetCopyClear((GXColor){ 0, 0, 0, 0 }, GX_MAX_Z24);
if (rmode->aa) GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR) ; // Set 16 bit RGB565 if (rmode->aa) GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR); // Set 16 bit RGB565
else GX_SetPixelFmt(GX_PF_RGB8_Z24 , GX_ZC_LINEAR) ; // Set 24 bit Z24 else GX_SetPixelFmt(GX_PF_RGB8_Z24 , GX_ZC_LINEAR); // Set 24 bit Z24
// Other GX setup // Other GX setup
yscale = GX_GetYScaleFactor(rmode->efbHeight, rmode->xfbHeight); yscale = GX_GetYScaleFactor(rmode->efbHeight, rmode->xfbHeight);
@ -176,8 +176,8 @@ int GRRLIB_Init (void) {
*/ */
void GRRLIB_Exit (void) { void GRRLIB_Exit (void) {
static bool done = false; static bool done = false;
if (done || !is_setup) return ; if (done || !is_setup) return;
else done = true ; else done = true;
// Allow write access to the full screen // Allow write access to the full screen
GX_SetClipMode( GX_CLIP_DISABLE ); GX_SetClipMode( GX_CLIP_DISABLE );

View file

@ -50,6 +50,6 @@ void GRRLIB_Circle (const f32 x, const f32 y, const f32 radius,
ncolor[a] = color; ncolor[a] = color;
} }
if (!filled) GRRLIB_GXEngine(v, ncolor, 36, GX_LINESTRIP ) ; if (!filled) GRRLIB_GXEngine(v, ncolor, 36, GX_LINESTRIP );
else GRRLIB_GXEngine(v, ncolor, 36, GX_TRIANGLEFAN) ; else GRRLIB_GXEngine(v, ncolor, 36, GX_TRIANGLEFAN);
} }

View file

@ -36,11 +36,11 @@ int GRRLIB_LoadFile(const char* filename, unsigned char* *data) {
FILE *fd; FILE *fd;
// Open the file // Open the file
if ( !(fd = fopen(filename, "rb")) ) return -1 ; if ( !(fd = fopen(filename, "rb")) ) return -1;
// Get file length // Get file length
fseek(fd, 0, SEEK_END); fseek(fd, 0, SEEK_END);
if ( !(len = ftell(fd)) ) { if ( !(len = ftell(fd)) ) {
*data = NULL; *data = NULL;
return 0; return 0;
} }
@ -48,14 +48,14 @@ int GRRLIB_LoadFile(const char* filename, unsigned char* *data) {
// Grab some memory in which to store the file // Grab some memory in which to store the file
if ( !(*data = malloc(len)) ) { if ( !(*data = malloc(len)) ) {
fclose(fd); fclose(fd);
return -2; return -2;
} }
if ( fread(*data, 1, len, fd) != len) { if ( fread(*data, 1, len, fd) != len) {
fclose(fd); fclose(fd);
free(*data); *data = NULL; free(*data); *data = NULL;
return -3; return -3;
} }
fclose(fd); fclose(fd);
@ -72,7 +72,7 @@ GRRLIB_texImg* GRRLIB_LoadTextureFromFile(const char *filename) {
unsigned char *data; unsigned char *data;
// return NULL it load fails // return NULL it load fails
if (GRRLIB_LoadFile(filename, &data) <= 0) return NULL ; if (GRRLIB_LoadFile(filename, &data) <= 0) return NULL;
// Convert to texture // Convert to texture
tex = GRRLIB_LoadTexture(data); tex = GRRLIB_LoadTexture(data);

View file

@ -44,7 +44,7 @@ void GRRLIB_DrawImg (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
u16 width, height; u16 width, height;
Mtx m, m1, m2, mv; Mtx m, m1, m2, mv;
if (tex == NULL || tex->data == NULL) return ; if (tex == NULL || tex->data == NULL) return;
GX_InitTexObj(&texObj, tex->data, tex->w, tex->h, GX_InitTexObj(&texObj, tex->data, tex->w, tex->h,
GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE); GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
@ -114,7 +114,7 @@ void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex, const u32 c
GXTexObj texObj; GXTexObj texObj;
Mtx m, m1, m2, mv; Mtx m, m1, m2, mv;
if (tex == NULL || tex->data == NULL) return ; if (tex == NULL || tex->data == NULL) return;
GX_InitTexObj(&texObj, tex->data, tex->w, tex->h, GX_InitTexObj(&texObj, tex->data, tex->w, tex->h,
GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE); GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
@ -179,7 +179,7 @@ void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
Mtx m, m1, m2, mv; Mtx m, m1, m2, mv;
f32 s1, s2, t1, t2; f32 s1, s2, t1, t2;
if (tex == NULL || tex->data == NULL) return ; if (tex == NULL || tex->data == NULL) return;
// The 0.001f/x is the frame correction formula by spiffen // The 0.001f/x is the frame correction formula by spiffen
s1 = (frame % tex->nbtilew) * tex->ofnormaltexx; s1 = (frame % tex->nbtilew) * tex->ofnormaltexx;
@ -267,7 +267,7 @@ void GRRLIB_DrawPart (const f32 xpos, const f32 ypos, const f32 partx, const f3
Mtx m, m1, m2, mv; Mtx m, m1, m2, mv;
f32 s1, s2, t1, t2; f32 s1, s2, t1, t2;
if (tex == NULL || tex->data == NULL) return ; if (tex == NULL || tex->data == NULL) return;
// The 0.001f/x is the frame correction formula by spiffen // The 0.001f/x is the frame correction formula by spiffen
s1 = (partx /tex->w) +(0.001f /tex->w); s1 = (partx /tex->w) +(0.001f /tex->w);
@ -347,7 +347,7 @@ void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex, const u32
Mtx m, m1, m2, mv; Mtx m, m1, m2, mv;
f32 s1, s2, t1, t2; f32 s1, s2, t1, t2;
if (tex == NULL || tex->data == NULL) return ; if (tex == NULL || tex->data == NULL) return;
// The 0.001f/x is the frame correction formula by spiffen // The 0.001f/x is the frame correction formula by spiffen
s1 = (( (frame %tex->nbtilew) ) /(f32)tex->nbtilew) +(0.001f /tex->w); s1 = (( (frame %tex->nbtilew) ) /(f32)tex->nbtilew) +(0.001f /tex->w);
@ -419,5 +419,5 @@ void GRRLIB_Render (void) {
VIDEO_Flush(); // Flush video buffer to screen VIDEO_Flush(); // Flush video buffer to screen
VIDEO_WaitVSync(); // Wait for screen to update VIDEO_WaitVSync(); // Wait for screen to update
// Interlaced screens require two frames to update // Interlaced screens require two frames to update
if (rmode->viTVMode &VI_NON_INTERLACE) VIDEO_WaitVSync() ; if (rmode->viTVMode &VI_NON_INTERLACE) VIDEO_WaitVSync();
} }

View file

@ -61,6 +61,6 @@ void GRRLIB_CompoStart (void) {
void GRRLIB_CompoEnd(int posx, int posy, GRRLIB_texImg *tex) { void GRRLIB_CompoEnd(int posx, int posy, GRRLIB_texImg *tex) {
GRRLIB_Screen2Texture(posx, posy, tex, GX_TRUE); GRRLIB_Screen2Texture(posx, posy, tex, GX_TRUE);
if (rmode->aa) GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR) ; if (rmode->aa) GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR);
else GX_SetPixelFmt(GX_PF_RGB8_Z24 , GX_ZC_LINEAR) ; else GX_SetPixelFmt(GX_PF_RGB8_Z24 , GX_ZC_LINEAR);
} }

View file

@ -27,7 +27,7 @@ THE SOFTWARE.
static FT_Library ftLibrary; /**< A handle to a FreeType library instance. */ static FT_Library ftLibrary; /**< A handle to a FreeType library instance. */
// Static function prototypes // Static function prototypes
static void DrawBitmap(FT_Bitmap *bitmap, int offset, int top, const u32 color) ; static void DrawBitmap(FT_Bitmap *bitmap, int offset, int top, const u32 color);
/** /**

View file

@ -38,84 +38,84 @@ THE SOFTWARE.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_cExtn.h - C extensions (helper functions) // GRRLIB_cExtn.h - C extensions (helper functions)
INLINE u8 GRRLIB_ClampVar8 (f32 Value) ; INLINE u8 GRRLIB_ClampVar8 (f32 Value);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_clipping.h - Clipping control // GRRLIB_clipping.h - Clipping control
INLINE void GRRLIB_ClipReset (void) ; INLINE void GRRLIB_ClipReset (void);
INLINE void GRRLIB_ClipDrawing (const int x, const int y, INLINE void GRRLIB_ClipDrawing (const int x, const int y,
const int width, const int height) ; const int width, const int height);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_collision.h - Collision detection // GRRLIB_collision.h - Collision detection
INLINE bool GRRLIB_PtInRect (const int hotx, const int hoty, INLINE bool GRRLIB_PtInRect (const int hotx, const int hoty,
const int hotw, const int hoth, const int hotw, const int hoth,
const int wpadx, const int wpady) ; const int wpadx, const int wpady);
INLINE bool GRRLIB_RectInRect (const int rect1x, const int rect1y, INLINE bool GRRLIB_RectInRect (const int rect1x, const int rect1y,
const int rect1w, const int rect1h, const int rect1w, const int rect1h,
const int rect2x, const int rect2y, const int rect2x, const int rect2y,
const int rect2w, const int rect2h) ; const int rect2w, const int rect2h);
INLINE bool GRRLIB_RectOnRect (const int rect1x, const int rect1y, INLINE bool GRRLIB_RectOnRect (const int rect1x, const int rect1y,
const int rect1w, const int rect1h, const int rect1w, const int rect1h,
const int rect2x, const int rect2y, const int rect2x, const int rect2y,
const int rect2w, const int rect2h) ; const int rect2w, const int rect2h);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_fbComplex.h - // GRRLIB_fbComplex.h -
INLINE void GRRLIB_NPlot (const guVector v[], const u32 color[], INLINE void GRRLIB_NPlot (const guVector v[], const u32 color[],
const long n) ; const long n);
INLINE void GRRLIB_NGone (const guVector v[], const u32 color[], INLINE void GRRLIB_NGone (const guVector v[], const u32 color[],
const long n) ; const long n);
INLINE void GRRLIB_NGoneFilled (const guVector v[], const u32 color[], INLINE void GRRLIB_NGoneFilled (const guVector v[], const u32 color[],
const long n) ; const long n);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_fbGX.h - // GRRLIB_fbGX.h -
INLINE void GRRLIB_GXEngine (const guVector v[], const u32 color[], INLINE void GRRLIB_GXEngine (const guVector v[], const u32 color[],
const long n, const u8 fmt) ; const long n, const u8 fmt);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_fbSimple.h - // GRRLIB_fbSimple.h -
INLINE void GRRLIB_FillScreen (const u32 color) ; INLINE void GRRLIB_FillScreen (const u32 color);
INLINE void GRRLIB_Plot (const f32 x, const f32 y, const u32 color) ; INLINE void GRRLIB_Plot (const f32 x, const f32 y, const u32 color);
INLINE void GRRLIB_Line (const f32 x1, const f32 y1, INLINE void GRRLIB_Line (const f32 x1, const f32 y1,
const f32 x2, const f32 y2, const u32 color) ; const f32 x2, const f32 y2, const u32 color);
INLINE void GRRLIB_Rectangle (const f32 x, const f32 y, INLINE void GRRLIB_Rectangle (const f32 x, const f32 y,
const f32 width, const f32 height, const f32 width, const f32 height,
const u32 color, const u8 filled) ; const u32 color, const u8 filled);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_handle.h - Texture handle manipulation // GRRLIB_handle.h - Texture handle manipulation
INLINE void GRRLIB_SetHandle (GRRLIB_texImg *tex, const int x, const int y) ; INLINE void GRRLIB_SetHandle (GRRLIB_texImg *tex, const int x, const int y);
INLINE void GRRLIB_SetMidHandle (GRRLIB_texImg *tex, const bool enabled) ; INLINE void GRRLIB_SetMidHandle (GRRLIB_texImg *tex, const bool enabled);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_pixel.h - Pixel manipulation // GRRLIB_pixel.h - Pixel manipulation
INLINE u32 GRRLIB_GetPixelFromtexImg (const int x, const int y, INLINE u32 GRRLIB_GetPixelFromtexImg (const int x, const int y,
const GRRLIB_texImg *tex) ; const GRRLIB_texImg *tex);
INLINE void GRRLIB_SetPixelTotexImg (const int x, const int y, INLINE void GRRLIB_SetPixelTotexImg (const int x, const int y,
GRRLIB_texImg *tex, const u32 color) ; GRRLIB_texImg *tex, const u32 color);
INLINE void GRRLIB_GetPixelFromFB (int x, int y, INLINE void GRRLIB_GetPixelFromFB (int x, int y,
u8 *R1, u8 *G1, u8 *B1, u8 *R1, u8 *G1, u8 *B1,
u8 *R2, u8 *G2, u8 *B2) ; u8 *R2, u8 *G2, u8 *B2);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_settings.h - Rendering functions // GRRLIB_settings.h - Rendering functions
INLINE void GRRLIB_SetBlend (const GRRLIB_blendMode blendmode) ; INLINE void GRRLIB_SetBlend (const GRRLIB_blendMode blendmode);
INLINE GRRLIB_blendMode GRRLIB_GetBlend (void) ; INLINE GRRLIB_blendMode GRRLIB_GetBlend (void);
INLINE void GRRLIB_SetAntiAliasing (const bool aa) ; INLINE void GRRLIB_SetAntiAliasing (const bool aa);
INLINE bool GRRLIB_GetAntiAliasing (void) ; INLINE bool GRRLIB_GetAntiAliasing (void);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_texSetup.h - Create and setup textures // GRRLIB_texSetup.h - Create and setup textures
INLINE GRRLIB_texImg* GRRLIB_CreateEmptyTexture (const uint w, const uint h) ; INLINE GRRLIB_texImg* GRRLIB_CreateEmptyTexture (const uint w, const uint h);
INLINE void GRRLIB_ClearTex (GRRLIB_texImg* tex) ; INLINE void GRRLIB_ClearTex (GRRLIB_texImg* tex);
INLINE void GRRLIB_FlushTex (GRRLIB_texImg *tex) ; INLINE void GRRLIB_FlushTex (GRRLIB_texImg *tex);
INLINE void GRRLIB_FreeTexture (GRRLIB_texImg *tex) ; INLINE void GRRLIB_FreeTexture (GRRLIB_texImg *tex);
//============================================================================== //==============================================================================
// Definitions of inlined functions // Definitions of inlined functions

View file

@ -38,101 +38,101 @@ THE SOFTWARE.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_bmf.c - BitMapFont functions // GRRLIB_bmf.c - BitMapFont functions
GRRLIB_bytemapFont* GRRLIB_LoadBMF (const u8 my_bmf[] ) ; GRRLIB_bytemapFont* GRRLIB_LoadBMF (const u8 my_bmf[] );
void GRRLIB_FreeBMF (const GRRLIB_bytemapFont *bmf) ; void GRRLIB_FreeBMF (const GRRLIB_bytemapFont *bmf);
void GRRLIB_InitTileSet (GRRLIB_texImg *tex, void GRRLIB_InitTileSet (GRRLIB_texImg *tex,
const uint tilew, const uint tileh, const uint tilew, const uint tileh,
const uint tilestart) ; const uint tilestart);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_bmfx.c - Bitmap f/x // GRRLIB_bmfx.c - Bitmap f/x
void GRRLIB_BMFX_FlipH (const GRRLIB_texImg *texsrc, void GRRLIB_BMFX_FlipH (const GRRLIB_texImg *texsrc,
GRRLIB_texImg *texdest) ; GRRLIB_texImg *texdest);
void GRRLIB_BMFX_FlipV (const GRRLIB_texImg *texsrc, void GRRLIB_BMFX_FlipV (const GRRLIB_texImg *texsrc,
GRRLIB_texImg *texdest) ; GRRLIB_texImg *texdest);
void GRRLIB_BMFX_Grayscale (const GRRLIB_texImg *texsrc, void GRRLIB_BMFX_Grayscale (const GRRLIB_texImg *texsrc,
GRRLIB_texImg *texdest) ; GRRLIB_texImg *texdest);
void GRRLIB_BMFX_Sepia (const GRRLIB_texImg *texsrc, void GRRLIB_BMFX_Sepia (const GRRLIB_texImg *texsrc,
GRRLIB_texImg *texdest) ; GRRLIB_texImg *texdest);
void GRRLIB_BMFX_Invert (const GRRLIB_texImg *texsrc, void GRRLIB_BMFX_Invert (const GRRLIB_texImg *texsrc,
GRRLIB_texImg *texdest) ; GRRLIB_texImg *texdest);
void GRRLIB_BMFX_Blur (const GRRLIB_texImg *texsrc, void GRRLIB_BMFX_Blur (const GRRLIB_texImg *texsrc,
GRRLIB_texImg *texdest, const u32 factor) ; GRRLIB_texImg *texdest, const u32 factor);
void GRRLIB_BMFX_Scatter (const GRRLIB_texImg *texsrc, void GRRLIB_BMFX_Scatter (const GRRLIB_texImg *texsrc,
GRRLIB_texImg *texdest, const u32 factor) ; GRRLIB_texImg *texdest, const u32 factor);
void GRRLIB_BMFX_Pixelate (const GRRLIB_texImg *texsrc, void GRRLIB_BMFX_Pixelate (const GRRLIB_texImg *texsrc,
GRRLIB_texImg *texdest, const u32 factor) ; GRRLIB_texImg *texdest, const u32 factor);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_core.c - GRRLIB core functions // GRRLIB_core.c - GRRLIB core functions
int GRRLIB_Init (void) ; int GRRLIB_Init (void);
void GRRLIB_Exit (void) ; void GRRLIB_Exit (void);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_fbAdvanced.c - Render to framebuffer: Advanced primitives // GRRLIB_fbAdvanced.c - Render to framebuffer: Advanced primitives
void GRRLIB_Circle (const f32 x, const f32 y, const f32 radius, void GRRLIB_Circle (const f32 x, const f32 y, const f32 radius,
const u32 color, const u8 filled) ; const u32 color, const u8 filled);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_fileIO - File I/O (SD Card) // GRRLIB_fileIO - File I/O (SD Card)
int GRRLIB_LoadFile (const char* filename, int GRRLIB_LoadFile (const char* filename,
unsigned char* *data) ; unsigned char* *data);
GRRLIB_texImg* GRRLIB_LoadTextureFromFile (const char* filename) ; GRRLIB_texImg* GRRLIB_LoadTextureFromFile (const char* filename);
bool GRRLIB_ScrShot (const char* filename) ; bool GRRLIB_ScrShot (const char* filename);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_print.c - Will someome please tell me what these are :) // GRRLIB_print.c - Will someome please tell me what these are :)
void GRRLIB_Printf (const f32 xpos, const f32 ypos, void GRRLIB_Printf (const f32 xpos, const f32 ypos,
const GRRLIB_texImg *tex, const u32 color, const GRRLIB_texImg *tex, const u32 color,
const f32 zoom, const char *text, ...) ; const f32 zoom, const char *text, ...);
void GRRLIB_PrintBMF (const f32 xpos, const f32 ypos, void GRRLIB_PrintBMF (const f32 xpos, const f32 ypos,
const GRRLIB_bytemapFont *bmf, const GRRLIB_bytemapFont *bmf,
const char *text, ...) ; const char *text, ...);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_render.c - Rendering functions // GRRLIB_render.c - Rendering functions
void GRRLIB_DrawImg (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex, void GRRLIB_DrawImg (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
const f32 degrees, const f32 scaleX, const f32 scaleY, const f32 degrees, const f32 scaleX, const f32 scaleY,
const u32 color) ; const u32 color);
void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex, void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex,
const u32 color) ; const u32 color);
void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex, void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
const f32 degrees, const f32 scaleX, const f32 scaleY, const f32 degrees, const f32 scaleX, const f32 scaleY,
const u32 color, const int frame) ; const u32 color, const int frame);
void GRRLIB_DrawPart (const f32 xpos, const f32 ypos, const f32 partx, const f32 party, 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 partw, const f32 parth, const GRRLIB_texImg *tex,
const f32 degrees, const f32 scaleX, const f32 scaleY, const f32 degrees, const f32 scaleX, const f32 scaleY,
const u32 color) ; const u32 color);
void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex, const u32 color, const int frame) ; void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex, const u32 color, const int frame);
void GRRLIB_Render (void) ; void GRRLIB_Render (void);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_snapshot.c - Create a texture containing a snapshot of a part of the framebuffer // GRRLIB_snapshot.c - Create a texture containing a snapshot of a part of the framebuffer
void GRRLIB_Screen2Texture (int posx, int posy, GRRLIB_texImg *tex, bool clear) ; void GRRLIB_Screen2Texture (int posx, int posy, GRRLIB_texImg *tex, bool clear);
void GRRLIB_CompoStart (void); void GRRLIB_CompoStart (void);
void GRRLIB_CompoEnd(int posx, int posy, GRRLIB_texImg *tex); void GRRLIB_CompoEnd(int posx, int posy, GRRLIB_texImg *tex);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_texEdit.c - Modifying the content of a texture // GRRLIB_texEdit.c - Modifying the content of a texture
GRRLIB_texImg* GRRLIB_LoadTexture (const u8 *my_img) ; GRRLIB_texImg* GRRLIB_LoadTexture (const u8 *my_img);
GRRLIB_texImg* GRRLIB_LoadTexturePNG (const u8 *my_png) ; GRRLIB_texImg* GRRLIB_LoadTexturePNG (const u8 *my_png);
GRRLIB_texImg* GRRLIB_LoadTextureJPG (const u8 *my_jpg) ; GRRLIB_texImg* GRRLIB_LoadTextureJPG (const u8 *my_jpg);
GRRLIB_texImg* GRRLIB_LoadTextureJPGEx (const u8 *my_jpg, const int) ; GRRLIB_texImg* GRRLIB_LoadTextureJPGEx (const u8 *my_jpg, const int);
GRRLIB_texImg* GRRLIB_LoadTextureBMP (const u8 *my_bmp) ; GRRLIB_texImg* GRRLIB_LoadTextureBMP (const u8 *my_bmp);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_gecko.c - USB_Gecko output facilities // GRRLIB_gecko.c - USB_Gecko output facilities

View file

@ -36,8 +36,8 @@ THE SOFTWARE.
INLINE INLINE
u8 GRRLIB_ClampVar8 (f32 Value) { u8 GRRLIB_ClampVar8 (f32 Value) {
Value = roundf(Value); Value = roundf(Value);
if (Value < 0) Value = 0 ; if (Value < 0) Value = 0;
else if (Value > 255) Value = 255 ; else if (Value > 255) Value = 255;
return (u8)Value; return (u8)Value;
} }

View file

@ -85,5 +85,5 @@ bool GRRLIB_RectOnRect (const int rect1x, const int rect1y,
return GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x, rect2y) || return GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x, rect2y) ||
GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x+rect2w, rect2y) || GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x+rect2w, rect2y) ||
GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x+rect2w, rect2y+rect2h) || GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x+rect2w, rect2y+rect2h) ||
GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x, rect2y+rect2h) ; GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x, rect2y+rect2h);
} }

View file

@ -71,7 +71,7 @@ void GRRLIB_FlushTex (GRRLIB_texImg *tex) {
INLINE INLINE
void GRRLIB_FreeTexture (GRRLIB_texImg *tex) { void GRRLIB_FreeTexture (GRRLIB_texImg *tex) {
if(tex != NULL) { if(tex != NULL) {
if (tex->data != NULL) free(tex->data) ; if (tex->data != NULL) free(tex->data);
free(tex); free(tex);
tex = NULL; tex = NULL;
} }

View file

@ -159,9 +159,9 @@ int main() {
while(1) { while(1) {
GRRLIB_2dMode(); GRRLIB_2dMode();
WPAD_ScanPads(); WPAD_ScanPads();
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break ; if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break;
if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_PLUS) camZ+=20.0f ; if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_PLUS) camZ+=20.0f;
if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_MINUS) camZ-=20.0f ; if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_MINUS) camZ-=20.0f;
if((dirx==0) && (diry==0)) { if((dirx==0) && (diry==0)) {
if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_LEFT) { diry=-4; idperso=15;} if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_LEFT) { diry=-4; idperso=15;}

View file

@ -10,7 +10,7 @@
int main() { int main() {
int offset1, offset2, offset3, offset4; int offset1, offset2, offset3, offset4;
int periode1, periode2, periode3, periode4 ; int periode1, periode2, periode3, periode4;
int length1, length2, length3, length4; int length1, length2, length3, length4;
int amp1, amp2, amp3, amp4; int amp1, amp2, amp3, amp4;
int origine1, origine2, origine3, origine4; int origine1, origine2, origine3, origine4;
@ -67,14 +67,14 @@ int main() {
while(1) { while(1) {
GRRLIB_FillScreen(0x000000FF); GRRLIB_FillScreen(0x000000FF);
WPAD_ScanPads(); // Scan the wiimotes WPAD_ScanPads(); // Scan the wiimotes
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break ; if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break;
old1=siny1;old2=siny2;old3=siny3;old4=siny4; old1=siny1; old2=siny2; old3=siny3; old4=siny4;
for(x=0;x<=640;x++) { for(x=0;x<=640;x++) {
siny1+=pas1; siny1+=pas1;
siny2+=pas2; siny2+=pas2;
siny3+=pas3; siny3+=pas3;
siny4+=pas4; siny4+=pas4;
GX_Begin(GX_LINES, GX_VTXFMT0, 2); GX_Begin(GX_LINES, GX_VTXFMT0, 2);
@ -91,9 +91,9 @@ int main() {
GX_End(); GX_End();
} }
siny1=old1+(adc1*pas1); siny1=old1+(adc1*pas1);
siny2=old2+(adc2*pas2); siny2=old2+(adc2*pas2);
siny3=old3+(adc3*pas3); siny3=old3+(adc3*pas3);
siny4=old4+(adc4*pas4); siny4=old4+(adc4*pas4);
GRRLIB_Render(); // Render the frame buffer to the TV GRRLIB_Render(); // Render the frame buffer to the TV