I am developing a small framework that I can use when starting a new game project, the framework provides the basics I need each project ... like initialising , putting text on the screen, loading images, feedback from the code.
It was all going fine until I added the FPS meter, then I notice the FPS take a dive when the console was displaying messages... a HUGE dive, from max of 500 FPS ( no message from console) to 293 with only 23 messages being displayed.
To display text on the screen I use a basic bitmap font system, taken from Lazy Foo's tutorial and mixed with sdltutorials code.
In brief it :
Loads the bitmap font image onto a SDL_Surface, converting the image using SDL_DisplayFormat .
Stores the clipping data for each character in an static array of SDL_Rect objects
Uses ASCII values of each character to reference the relevant SDL_Rect object to provide clipping data to the draw function
Draw function is the typical blit from source ( the surface holding the font image) to destination ( main display).
video is set using SDL_HWSURFACE | SDL_DOUBLEBUF flags.
I realise it is a lot of looping and work to put up an image for each character in a string of text, but losing 200+ FPS for loosely spaced text on a screen normal ?
Question: Is a huge loss of updates per second to be expected when dsplaying a lot of text on the screen using a bitmap font system ?
Is there anyway to avoid this loss in SDL / C++ ?
Edited by ASnogarD, 20 June 2012 - 05:14 AM.