[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: drawing a string using SDL
Scrive Abhir Joshi <email@example.com>:
> As of now, I blit BMP images containing the text. But the images need
> to recreated using GIMP whenever the text is to be changed. What if I
> want to print arbitrary text at runtime? Do I need to have a bitmap
> for each and every character and then blit those bitmaps according to
> the characters in the string? Is there some library already written
> for this?
AFAIK SDL has no text capabilities: you have to implement your own text-routines.
That means: yes, you must have a bitmap for at least the first ASCII characters
(ranging from 32 to about 127) and use a routine that blits them on screen
according to the text you're going to draw.
I've done a library indipendent implementation of it for my game, it is not that
You can also search for some SDL extension library adding the capabilities you
If you want a bit of text support you may try ALLEGRO: it does quite the same
things as SDL but has a fair text support and built-in fonts, here it is:
In the end, however, i'd suggest you to use always OpenGL and maybe GLUT: better
performance, better portability, nicer results.