mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-12-23 02:39:19 +00:00
[NEW] Added GRRLIB_FreeTexture to free memory
This commit is contained in:
parent
af79603ae4
commit
5bb6d7d5a4
2 changed files with 13 additions and 2 deletions
|
@ -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.
|
||||
|
@ -533,7 +543,7 @@ inline void GRRLIB_DrawImg(f32 xpos, f32 ypos, struct GRRLIB_texImg *tex, float
|
|||
if (GRRLIB_Settings.antialias == false) {
|
||||
GX_InitTexObjLOD(&texObj, GX_NEAR, GX_NEAR, 0.0f, 0.0f, 0.0f, 0, 0, GX_ANISO_1);
|
||||
}
|
||||
|
||||
|
||||
GX_LoadTexObj(&texObj, GX_TEXMAP0);
|
||||
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
||||
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue