fontdemo.c
I had to install the SDL_ttf dev library to compile this one.
The command line to compile this is:
gcc `sdl-config --cflags --libs` -lSDL_ttf fontdemo.c
Notice the additional
-lSDL_ttf
that was added.
The original example code is here.
The arial ttf library is at that link. It has to be renamed to all lowercase to work.
I added a check to see of the font was loaded, the program crashes if font is not found. I made the font background transparent so the font would overlay onto the graphic. I added the graphic.
Updated this to use a different method of creating the text.
Everything the same as above, here is the new code:
fontdemo2.c
No comments:
Post a Comment