But we also need a cache for TTF rendering
(eg. keep 200 objects with a algorithm to sort them as "last used", good
algorithms exist).
What will we cache :  glyphs or pieces of text ?
That sounds good... Perhaps the fist thing to do - I think - is that we should find a better way to display text as it is near unreadable when it is displayed on top of a light or white surface than we should optimize it.

Another way is to generalize what I have done for the characters name. Each class which renders text could have a direct reference to the SDL_Surface containing the text, deleting the surface and creating it when the text changes (but not for each frame !! ;-))

Matt

Répondre à