[SDL] Nonconstant arguments on SDL functions

Roberto Fischer roberto.fischer at globo.com
Thu Sep 7 19:01:03 PDT 2006


I was writing a wapper for text on C++, using SDL_ttf, and had some 
problems with a const method that returns the heigh of the rendered text. 
My text implementation uses a vector of SDL_Surface*, each containing one 
line. When drawing on any target surface, I blit each of these surfaces, 
one below the others, using a vertical value returned by 
TTF_FontLineSkip(). On that method to return the height of the rendered 
text, I do a multiplication of the number of lines by that line skip value. 
But, since it's a const method, I can't use TTF_FontLineSkip, as it 
receives TTF_Font*, instead of const TTF_Font*.

Checking the source code on SDL_ttf, I didn't see any read-only functions 
with const arguments. I noticed the same thing on SDL functions such as 
SDL_SaveBMP (receives const char* and why not also const SDL_Surface*?). Is 
this as it is really supposed to be?

Roberto Fischer.

More information about the SDL mailing list