From 1b49480c0f5779dc33d71523fee246aa5d050cda Mon Sep 17 00:00:00 2001 From: Crayon2000 Date: Wed, 16 Mar 2011 01:24:01 +0000 Subject: [PATCH] [CHG] Updated examples to put all GRRLIB_FreeTexture/GRRLIB_FreeBMF/GRRLIB_FreeTTF call before GRRLIB_Exit --- examples/3D_CubedTileDemo/source/main.c | 2 +- examples/3D_Light1/source/main.c | 2 +- examples/3D_Light2/source/main.c | 2 +- examples/3D_Light3/source/main.c | 2 +- examples/3D_Light4/source/main.c | 1 + examples/3D_sample1/source/main.c | 2 +- examples/3D_sample2/source/main.c | 2 +- examples/3D_sample3/source/main.c | 2 +- examples/3D_sample5/source/main.c | 2 +- examples/NEED_GRRLIB_FUNCTION/source/main.c | 2 +- examples/TileDemo/source/main.c | 2 +- examples/basic_drawing/source/main.c | 2 +- examples/bitmap_fx/source/main.c | 2 +- examples/blending/source/main.c | 6 +++--- examples/compositing/source/main.c | 2 +- examples/particle/source/main.cpp | 6 +++--- examples/unlimited2d/source/main.c | 2 +- examples/unlimited3d/source/main.c | 2 +- 18 files changed, 22 insertions(+), 21 deletions(-) diff --git a/examples/3D_CubedTileDemo/source/main.c b/examples/3D_CubedTileDemo/source/main.c index 296cf46..ac2fcb4 100644 --- a/examples/3D_CubedTileDemo/source/main.c +++ b/examples/3D_CubedTileDemo/source/main.c @@ -339,12 +339,12 @@ int main() { GRRLIB_Render(); } - GRRLIB_Exit(); GRRLIB_FreeTexture(tex_tile1); GRRLIB_FreeTexture(tex_perso); GRRLIB_FreeTexture(tex_bg); GRRLIB_FreeTexture(tex_nonameno); GRRLIB_FreeTexture(tex_screen); + GRRLIB_Exit(); exit(0); } diff --git a/examples/3D_Light1/source/main.c b/examples/3D_Light1/source/main.c index 47a049c..b659b27 100644 --- a/examples/3D_Light1/source/main.c +++ b/examples/3D_Light1/source/main.c @@ -79,8 +79,8 @@ int main() { GRRLIB_Render(); } - GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB exit(0); } diff --git a/examples/3D_Light2/source/main.c b/examples/3D_Light2/source/main.c index a85ed9f..e1c4377 100644 --- a/examples/3D_Light2/source/main.c +++ b/examples/3D_Light2/source/main.c @@ -74,8 +74,8 @@ int main() { GRRLIB_Render(); } - GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB exit(0); } diff --git a/examples/3D_Light3/source/main.c b/examples/3D_Light3/source/main.c index 9d59e50..e7356ba 100644 --- a/examples/3D_Light3/source/main.c +++ b/examples/3D_Light3/source/main.c @@ -96,8 +96,8 @@ int main() { GRRLIB_Printf(50, 60, tex_font, 0xFFFFFFFF, 1, "Use ( A / B ) to change the shyniness value : %d ",(int)shy); GRRLIB_Render(); } - GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB exit(0); } diff --git a/examples/3D_Light4/source/main.c b/examples/3D_Light4/source/main.c index b95f54c..f4fe52f 100644 --- a/examples/3D_Light4/source/main.c +++ b/examples/3D_Light4/source/main.c @@ -47,6 +47,7 @@ int main(int argc, char **argv) { GRRLIB_Render(); } + GRRLIB_FreeTexture(tex_font); GRRLIB_Exit(); exit(0); diff --git a/examples/3D_sample1/source/main.c b/examples/3D_sample1/source/main.c index 25cb727..37d651b 100644 --- a/examples/3D_sample1/source/main.c +++ b/examples/3D_sample1/source/main.c @@ -99,8 +99,8 @@ int main() { GRRLIB_Render(); } - GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB exit(0); } diff --git a/examples/3D_sample2/source/main.c b/examples/3D_sample2/source/main.c index dbe4952..897a061 100644 --- a/examples/3D_sample2/source/main.c +++ b/examples/3D_sample2/source/main.c @@ -128,9 +128,9 @@ int main() { GRRLIB_Render(); } - GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB GRRLIB_FreeTexture(tex_girl); GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB exit(0); } diff --git a/examples/3D_sample3/source/main.c b/examples/3D_sample3/source/main.c index 98fa77e..712c10b 100644 --- a/examples/3D_sample3/source/main.c +++ b/examples/3D_sample3/source/main.c @@ -144,10 +144,10 @@ int main() { GRRLIB_Render(); } - GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB GRRLIB_FreeTexture(tex_girl); GRRLIB_FreeTexture(tex_font); GRRLIB_FreeTexture(tex_screen); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB exit(0); } diff --git a/examples/3D_sample5/source/main.c b/examples/3D_sample5/source/main.c index 8d6aadf..f152b5b 100644 --- a/examples/3D_sample5/source/main.c +++ b/examples/3D_sample5/source/main.c @@ -97,8 +97,8 @@ int main(void){ GRRLIB_Printf((640-(16*29))/2, 20, tex_font, 0xFFFFFFFF, 1, "JUST ANOTHER 3D SAMPLE"); GRRLIB_Render(); } - GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB exit(0); } diff --git a/examples/NEED_GRRLIB_FUNCTION/source/main.c b/examples/NEED_GRRLIB_FUNCTION/source/main.c index 2b7c46d..4b98f1f 100644 --- a/examples/NEED_GRRLIB_FUNCTION/source/main.c +++ b/examples/NEED_GRRLIB_FUNCTION/source/main.c @@ -251,8 +251,8 @@ GXTexObj texObj; GRRLIB_Render(); } - GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB exit(0); } diff --git a/examples/TileDemo/source/main.c b/examples/TileDemo/source/main.c index 4bc3b09..4030072 100644 --- a/examples/TileDemo/source/main.c +++ b/examples/TileDemo/source/main.c @@ -263,12 +263,12 @@ int main() { } - GRRLIB_Exit(); // Free some textures GRRLIB_FreeTexture(tex_tile1); GRRLIB_FreeTexture(tex_perso); GRRLIB_FreeTexture(tex_bg); GRRLIB_FreeTexture(tex_nonameno); + GRRLIB_Exit(); exit(0); } diff --git a/examples/basic_drawing/source/main.c b/examples/basic_drawing/source/main.c index 8d30ac4..070b53e 100644 --- a/examples/basic_drawing/source/main.c +++ b/examples/basic_drawing/source/main.c @@ -219,7 +219,6 @@ int main() { GRRLIB_Render(); FPS = CalculateFrameRate(); } - GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB // Free some textures GRRLIB_FreeTexture(tex_test_jpg); GRRLIB_FreeTexture(tex_test_bmp); @@ -231,6 +230,7 @@ int main() { GRRLIB_FreeTexture(tex_BMfont5); GRRLIB_FreeBMF(bmf_Font1); GRRLIB_FreeBMF(bmf_Font2); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB return 0; } diff --git a/examples/bitmap_fx/source/main.c b/examples/bitmap_fx/source/main.c index db43296..d6fc99b 100644 --- a/examples/bitmap_fx/source/main.c +++ b/examples/bitmap_fx/source/main.c @@ -202,7 +202,6 @@ int main() { if(page > 7) page = 0; } } - GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB GRRLIB_FreeTexture(tex_pirate); GRRLIB_FreeTexture(tex_gray); GRRLIB_FreeTexture(tex_sepia); @@ -228,5 +227,6 @@ int main() { GRRLIB_FreeTexture(tex_scatter4); GRRLIB_FreeTexture(tex_scatter5); GRRLIB_FreeTexture(tex_scatter6); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB return 0; } diff --git a/examples/blending/source/main.c b/examples/blending/source/main.c index 6efe53b..058afc4 100644 --- a/examples/blending/source/main.c +++ b/examples/blending/source/main.c @@ -125,9 +125,6 @@ int main() { } static void ExitGame() { - // Deinitialize GRRLIB & Video - GRRLIB_Exit(); - // Free all memory used by textures. GRRLIB_FreeTexture(GFX_Background); GRRLIB_FreeTexture(GFX_Blob[0]); @@ -135,6 +132,9 @@ static void ExitGame() { GRRLIB_FreeTexture(GFX_Blob[2]); GRRLIB_FreeTexture(GFX_Font); + // Deinitialize GRRLIB & Video + GRRLIB_Exit(); + // Exit application exit(0); } diff --git a/examples/compositing/source/main.c b/examples/compositing/source/main.c index 6531582..12db972 100644 --- a/examples/compositing/source/main.c +++ b/examples/compositing/source/main.c @@ -57,9 +57,9 @@ int main() { GRRLIB_Render(); } - GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB GRRLIB_FreeTexture(tex_screen); GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB exit(0); } diff --git a/examples/particle/source/main.cpp b/examples/particle/source/main.cpp index 244ea64..2aa7153 100644 --- a/examples/particle/source/main.cpp +++ b/examples/particle/source/main.cpp @@ -258,9 +258,6 @@ static bool updateParticle( Particle *part ) { static void ExitGame() { - // Deinitialize GRRLIB & Video - GRRLIB_Exit(); - // Free all memory used by textures. for (vector::iterator TexIter = TextureList.begin(); TexIter != TextureList.end(); TexIter++) { free((*TexIter)->data); @@ -268,6 +265,9 @@ static void ExitGame() { } TextureList.clear(); + // Deinitialize GRRLIB & Video + GRRLIB_Exit(); + // Exit application exit(0); } diff --git a/examples/unlimited2d/source/main.c b/examples/unlimited2d/source/main.c index 55925ed..961f541 100644 --- a/examples/unlimited2d/source/main.c +++ b/examples/unlimited2d/source/main.c @@ -89,12 +89,12 @@ int main() { if(WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0); } - GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB GRRLIB_FreeTexture(tex_logo); GRRLIB_FreeTexture(tex_ball); GRRLIB_FreeTexture(tex_font); for(i=0; i<10; i++) { GRRLIB_FreeTexture(tex_screen[i]); } + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB return 0; } diff --git a/examples/unlimited3d/source/main.c b/examples/unlimited3d/source/main.c index 23174fc..06d51ad 100644 --- a/examples/unlimited3d/source/main.c +++ b/examples/unlimited3d/source/main.c @@ -186,13 +186,13 @@ int main() { if(WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0); } - GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB GRRLIB_FreeTexture(tex_logo); GRRLIB_FreeTexture(tex_girl); GRRLIB_FreeTexture(tex_font); for(i=0; i<9; i++) { GRRLIB_FreeTexture(tex_screen[i]); } + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB return 0; }