|
SDL ttf question July 26, 2009 09:11PM | Registered: 16 years ago Posts: 5 |
Quote
SDL_SetError: Out of memory
SDL_SetError: SDL_UpperBlit: passed a NULL surface
|
Re: SDL ttf question July 26, 2009 10:01PM | Registered: 16 years ago Posts: 703 |
|
Re: SDL ttf question July 26, 2009 10:20PM | Registered: 16 years ago Posts: 5 |
|
Re: SDL ttf question July 26, 2009 11:08PM | Registered: 17 years ago Posts: 265 |
|
Re: SDL ttf question July 26, 2009 11:17PM | Registered: 16 years ago Posts: 703 |
scoret = 0; scoret = TTF_RenderText_Blended( font, buffer, textColor ); if (scoret) apply_surface( 200, 20, scoret, screen );
|
Re: SDL ttf question July 26, 2009 11:48PM | Registered: 16 years ago Posts: 5 |
http://sdl-wii.googlecode.com/files/SDL%20Wii%2005-13-2009.zipQuote
http://sdl-wii.googlecode.com/files/SDL%20Wii%2005-13-2009.zip
TTF_RenderText_Blended( font, buffer, textColor );gives the same error.
|
Re: SDL ttf question July 27, 2009 12:20AM | Registered: 16 years ago Posts: 703 |
|
Re: SDL ttf question July 27, 2009 12:29AM | Registered: 16 years ago Posts: 5 |
|
Re: SDL ttf question July 27, 2009 06:13PM | Registered: 16 years ago Posts: 703 |
|
Re: SDL ttf question July 27, 2009 06:42PM | Registered: 16 years ago Posts: 276 |
|
Re: SDL ttf question July 27, 2009 06:43PM | Registered: 17 years ago Posts: 265 |
|
Re: SDL ttf question July 27, 2009 07:05PM | Registered: 16 years ago Posts: 5 |
if(scoret){SDL_FreeSurface(scoret);}
in the loop just before the rendering, and now SDL makes no errors :-)|
Re: SDL ttf question July 27, 2009 07:10PM | Registered: 16 years ago Posts: 703 |
Quote
henke37
A quick google on the function quickly explains that it returns a pointer to a new surface. And the surface is not freed for you. And you are not freeing it either. That's what I call an obvious memory leak.
|
Re: SDL ttf question August 04, 2009 03:51PM | Registered: 16 years ago Posts: 10 |
Quote
scanff
The only thing different I do in my projects is initialize SDL to 24bit. I've never tried TTF with 16bit.
bool ReloadImage(SDL_Surface* &imageSurface, char* fileName)
{
SDL_FreeSurface(imageSurface); // free surface if it is not NULL
imageSurface = NULL;
imageSurface = load_image(fileName); // load new image - function from SDL tutorial
return imageSurface == NULL ? false : true;
}