Now trying to find this on the Internet for a while.
I have SDL_Surface with some content (in one of its text, in another - part of the sprite). Inside the game loop, I get the data on the screen in order. But then it loops again and does not replace the old data, but simply writes over it. So in the case of text, it becomes a mess.
I tried SDL_FreeSurface and it did not work, does anyone know another way?
fpsStream.str("");
fpsStream << fps.get_ticks();
fpsString = fpsStream.str();
game.fpsSurface = TTF_RenderText_Solid(game.fpsFont, fpsString.c_str(), textColor);
game.BlitSurface(0, 0, game.fpsSurface, game.screen);
source
share