[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: drawing a string using SDL
Scrive Abhir Joshi <abhir@vsnl.net>:
> 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
difficult.
You can also search for some SDL extension library adding the capabilities you
need: http://www.libsdl.org/libraries.php
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:
http://www.talula.demon.co.uk/allegro/
In the end, however, i'd suggest you to use always OpenGL and maybe GLUT: better
performance, better portability, nicer results.
Regards,
Francesco Orsenigo