[NEW] Added GRRLIB_FreeTexture to free memory

This commit is contained in:
Crayon2000 2009-03-13 22:27:40 +00:00
parent af79603ae4
commit 5bb6d7d5a4
2 changed files with 13 additions and 2 deletions

View file

@ -458,7 +458,7 @@ GRRLIB_bytemapFont *GRRLIB_LoadBMF(const unsigned char my_bmf[]) {
/**
* Free memory allocated by ByteMap fonts.
* @param bmf a GRRLIB_bytemapFont structure.
* @param bmf A GRRLIB_bytemapFont structure.
*/
void GRRLIB_FreeBMF(GRRLIB_bytemapFont *bmf) {
unsigned int i;
@ -485,6 +485,16 @@ GRRLIB_texImg *GRRLIB_LoadTexture(const unsigned char my_img[]) {
}
}
/**
* Free memory allocated for texture.
* @param tex A GRRLIB_texImg structure.
*/
void GRRLIB_FreeTexture(struct GRRLIB_texImg *tex) {
free(tex->data);
free(tex);
tex = NULL;
}
/**
* Create an empty texture.
* @param w Width of the new texture to create.

View file

@ -109,6 +109,7 @@ GRRLIB_texImg *GRRLIB_CreateEmptyTexture(unsigned int, unsigned int);
GRRLIB_texImg *GRRLIB_LoadTexture(const unsigned char my_img[]);
GRRLIB_texImg *GRRLIB_LoadTextureJPG(const unsigned char my_jpg[]);
GRRLIB_texImg *GRRLIB_LoadTexturePNG(const unsigned char my_png[]);
void GRRLIB_FreeTexture(struct GRRLIB_texImg *tex);
GRRLIB_bytemapFont *GRRLIB_LoadBMF(const unsigned char my_bmf[]);
void GRRLIB_FreeBMF(GRRLIB_bytemapFont *bmf);