[CHG] GRRLIB_LoadTexture now autodetect if its JPG or PNG

[DEL] GRRLIB_Credit is gone ;)
[CHG] Scatter removed from lesson1
This commit is contained in:
N0NameN0 2009-02-16 23:36:21 +00:00
parent 5f57f2e346
commit 9c6a0491eb
5 changed files with 34 additions and 4012 deletions

File diff suppressed because it is too large Load diff

View file

@ -47,8 +47,8 @@ void GRRLIB_NGone(Vector v[], u32 color, long n);
void GRRLIB_NGoneFilled(Vector v[], u32 color, long n);
GRRLIB_texImg GRRLIB_CreateEmptyTexture(unsigned int, unsigned int);
GRRLIB_texImg GRRLIB_LoadTexturePNG(const unsigned char my_png[]);
GRRLIB_texImg GRRLIB_LoadTextureJPG(const unsigned char my_jpg[]);
GRRLIB_texImg GRRLIB_LoadTexture(const unsigned char my_img[]);
void GRRLIB_InitTileSet(struct GRRLIB_texImg *tex, unsigned int tilew, unsigned int tileh, unsigned int tilestart);
@ -79,7 +79,6 @@ void GRRLIB_GXEngine(Vector v[], u32 color, long count, u8 fmt);
void GRRLIB_Init();
void GRRLIB_Credit();
void GRRLIB_Render();

View file

@ -64,31 +64,30 @@ int main() {
GRRLIB_Init();
GRRLIB_Credit();
fatInitDefault();
WPAD_Init();
WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR);
GRRLIB_texImg tex_test_jpg = GRRLIB_LoadTextureJPG(test_jpg);
GRRLIB_texImg tex_new = GRRLIB_CreateEmptyTexture(tex_test_jpg.w, tex_test_jpg.h);
GRRLIB_texImg tex_test_jpg = GRRLIB_LoadTexture(test_jpg);
GRRLIB_texImg tex_sprite_png = GRRLIB_LoadTexturePNG(sprite);
GRRLIB_texImg tex_sprite_png = GRRLIB_LoadTexture(sprite);
GRRLIB_InitTileSet(&tex_sprite_png, 24, 32, 0);
GRRLIB_texImg tex_BMfont1 = GRRLIB_LoadTexturePNG(BMfont1);
GRRLIB_texImg tex_BMfont1 = GRRLIB_LoadTexture(BMfont1);
GRRLIB_InitTileSet(&tex_BMfont1, 32, 32, 32);
GRRLIB_texImg tex_BMfont2 = GRRLIB_LoadTexturePNG(BMfont2);
GRRLIB_texImg tex_BMfont2 = GRRLIB_LoadTexture(BMfont2);
GRRLIB_InitTileSet(&tex_BMfont2, 16, 16, 32);
GRRLIB_texImg tex_BMfont3 = GRRLIB_LoadTexturePNG(BMfont3);
GRRLIB_texImg tex_BMfont3 = GRRLIB_LoadTexture(BMfont3);
GRRLIB_InitTileSet(&tex_BMfont3, 32, 32, 32);
GRRLIB_texImg tex_BMfont4 = GRRLIB_LoadTexturePNG(BMfont4);
GRRLIB_texImg tex_BMfont4 = GRRLIB_LoadTexture(BMfont4);
GRRLIB_InitTileSet(&tex_BMfont4, 16, 16, 32);
GRRLIB_texImg tex_BMfont5 = GRRLIB_LoadTexturePNG(BMfont5);
GRRLIB_texImg tex_BMfont5 = GRRLIB_LoadTexture(BMfont5);
GRRLIB_InitTileSet(&tex_BMfont5, 8, 16, 0);
while(1) {
@ -106,11 +105,8 @@ int main() {
case 1: // Draw images
GRRLIB_Printf(5, 25, tex_BMfont2, GRRLIB_WHITE, 1, "IMAGES DEMO");
GRRLIB_BMFX_Scatter(tex_test_jpg, tex_new, 8);
GRRLIB_FlushTex(tex_new);
GRRLIB_DrawImg(10, 50, tex_test_jpg, 0, 1, 1, GRRLIB_WHITE);
GRRLIB_DrawImg(310, 50, tex_new, 0, 1, 1, GRRLIB_WHITE);
// Draw a sprite
GRRLIB_DrawTile(600, 400, tex_sprite_png, 0, 2, 2, GRRLIB_WHITE, 12*4); // Rupee
@ -215,7 +211,6 @@ int main() {
}
GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
// Free some textures
free(tex_new.data);
free(tex_test_jpg.data);
free(tex_sprite_png.data);
free(tex_BMfont1.data);

View file

@ -23,11 +23,11 @@ int main() {
int page = 0;
// Font texture
GRRLIB_texImg text_font1 = GRRLIB_LoadTexturePNG(font1);
GRRLIB_texImg text_font1 = GRRLIB_LoadTexture(font1);
GRRLIB_InitTileSet(&text_font1, 32, 36, 32);
// Load the original texture and create empty texture of the same size as the original one
GRRLIB_texImg tex_pirate = GRRLIB_LoadTexturePNG(pirate);
GRRLIB_texImg tex_pirate = GRRLIB_LoadTexture(pirate);
GRRLIB_texImg tex_gray = GRRLIB_CreateEmptyTexture(tex_pirate.w, tex_pirate.h);
GRRLIB_texImg tex_invert = GRRLIB_CreateEmptyTexture(tex_pirate.w, tex_pirate.h);
GRRLIB_texImg tex_blur1 = GRRLIB_CreateEmptyTexture(tex_pirate.w, tex_pirate.h);

View file

@ -46,8 +46,6 @@ ChangeLog :
* GRRLIB_DrawTile recoded for simpler use + // --->Frame Correction by spiffen
* added GRRLIB_LoadTextureJPG (thx crayon for the file end detection idea)
* InitVideo() and GRRLIB_Start() merge into GRRLIB_Init().
* add GRRLIB_PtInRect, GRRLIB_RectInRect and GRRLIB_RectOnRect.
@ -64,10 +62,13 @@ ChangeLog :
- GRRLIB_BMFX_Scatter
- GRRLIB_BMFX_Blur
- GRRLIB_BMFX_Pixelate
(keep in mind that most BMFX are not provided to be used in real time ;) ;) )
* GRRLIB_LoadTexture now detect automaticaly the image format JPG or PNG
(keep in mind that image still have to be RGBA and have Width and height multiple of 4)
* add GRRLIB_Exit to free the memory allocated by GRRLIB
* add GRRLIB_Credit that you HAVE to call at least ONCE in your code to respect author desire !! ( thanks to respect our work following this rule !!)
have a look at the sample code to see how all this work ;)