sdlfont.h

00001 /*
00002   font.h
00003   Header for the Cone3D SDL font routines.
00004   Made by Marius Andra 2002
00005   http://cone3d.gamedev.net
00006 
00007   You can use the code for anything you like.
00008   Even in a commercial project.
00009   But please let me know where it ends up.
00010   I'm just curious. That's all.
00011 */
00012 
00013 #include <SDL/SDL.h>    // just in case...
00014 
00015 // Structure to hold our font
00016 struct SDLFont
00017 {
00018   SDL_Surface *font;    // The SDL Surface for the font image
00019   int width;            // Width of the SDL Surface (same as the height)
00020   int charWidth;        // Width of one block character in the font (fontWidth/16)
00021   int *widths;          // Real widths of all the fonts
00022   unsigned char *data;  // The raw font data
00023 };
00024 
00025 // Function prototypes
00026 
00027 // This function initalizes a font
00028 SDLFont *sdlFont_initFont(char *fontdir, float r, float g, float b, float a);
00029 
00030 // Some overloaded functions to make your life easier
00031 inline SDLFont *sdlFont_initFont(char *fontdir, float r, float g, float b) { return initFont(fontdir, r,g,b,1); }
00032 inline SDLFont *sdlFont_initFont(char *fontdir) { return initFont(fontdir, 1,1,1,1); }
00033 
00034 // This function draws a string
00035 void sdlFont_drawString(SDL_Surface *screen, SDLFont *font, int x, int y, char *str,...);
00036 
00037 // This function returns the width of a string
00038 int sdlFont_stringWidth(SDLFont *font, char *str,...);
00039 
00040 // This function destroys the font
00041 void sdlFont_freeFont(SDLFont *font);
00042 

SourceForge.net Logo
generated with doxygen 1.5.3 on Mon Oct 29 18:09:26 2007