First commit of SDL_Perl-2.1.3
[sdlgit/SDL_perl.git] / src / SFont.h
1 /************************************************************************ 
2 *    SFONT - SDL Font Library by Karl Bartel <karlb@gmx.net>            *
3 *                                                                       *
4 *  All functions are explained below. There are two versions of each    *
5 *  funtction. The first is the normal one, the function with the        *
6 *  2 at the end can be used when you want to handle more than one font  *
7 *  in your program.                                                     *
8 *                                                                       *
9 ************************************************************************/
10
11 #include "SDL.h"
12
13 #ifdef __cplusplus 
14 extern "C" {
15 #endif
16
17 // Delcare one variable of this type for each font you are using.
18 // To load the fonts, load the font image into YourFont->Surface
19 // and call InitFont( YourFont );
20 typedef struct {
21         SDL_Surface *Surface;   
22         int CharPos[512];
23         int h;
24 } SFont_FontInfo;
25
26 // Initializes the font
27 // Font: this contains the suface with the font.
28 //       The font must be loaded before using this function.
29 void InitFont (SDL_Surface *Font);
30 void InitFont2(SFont_FontInfo *Font);
31
32 // Blits a string to a surface
33 // Destination: the suface you want to blit to
34 // text: a string containing the text you want to blit.
35 void PutString (SDL_Surface *Surface, int x, int y, char *text);
36 void PutString2(SDL_Surface *Surface, SFont_FontInfo *Font, int x, int y, char *text);
37
38 // Returns the width of "text" in pixels
39 #ifdef MACOSX
40 int SFont_TextWidth(char *text);
41 int SFont_TextWidth2(SFont_FontInfo *Font, char *text);
42 #else
43 int TextWidth(char *text);
44 int TextWidth2(SFont_FontInfo *Font, char *text);
45 #endif
46
47 // Blits a string to with centered x position
48 void XCenteredString (SDL_Surface *Surface, int y, char *text);
49 void XCenteredString2(SDL_Surface *Surface, SFont_FontInfo *Font, int y, char *text);
50
51 // Allows the user to enter text
52 // Width: What is the maximum width of the text (in pixels)
53 // text: This string contains the text which was entered by the user
54 void SFont_Input ( SDL_Surface *Destination, int x, int y, int Width, char *text);
55 void SFont_Input2( SDL_Surface *Destination, SFont_FontInfo *Font, int x, int y, int Width, char *text);
56
57 #ifdef __cplusplus
58 }
59 #endif