PageRenderTime 21ms CodeModel.GetById 12ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/src/SDLx/SFont.h

http://github.com/PerlGameDev/SDL
C Header | 79 lines | 27 code | 9 blank | 43 comment | 0 complexity | 261b0c96b8ab50802077d2591285160a MD5 | raw file
 1/* */
 2/* SFont.h */
 3/* */
 4/* Original SFont code Copyright (C) Karl Bartel  */
 5/* Copyright (C) 2005 David J. Goehrig <dgoehrig@cpan.org> */
 6/* */
 7/* ------------------------------------------------------------------------------ */
 8/* */
 9/* This library is free software; you can redistribute it and/or */
10/* modify it under the terms of the GNU Lesser General Public */
11/* License as published by the Free Software Foundation; either */
12/* version 2.1 of the License, or (at your option) any later version. */
13/*  */
14/* This library is distributed in the hope that it will be useful, */
15/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
16/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU */
17/* Lesser General Public License for more details. */
18/*  */
19/* You should have received a copy of the GNU Lesser General Public */
20/* License along with this library; if not, write to the Free Software */
21/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA */
22/* */
23/* ------------------------------------------------------------------------------ */
24/* */
25/* Please feel free to send questions, suggestions or improvements to: */
26/* */
27/*	David J. Goehrig */
28/*	dgoehrig@cpan.org */
29/* */
30
31#include <SDL.h>
32
33#ifdef __cplusplus 
34extern "C" {
35#endif
36
37/* Delcare one variable of this type for each font you are using. */
38/* To load the fonts, load the font image into YourFont->Surface */
39/* and call InitFont( YourFont ); */
40typedef struct {
41	SDL_Surface *Surface;	
42	int CharPos[512];
43	int h;
44} SFont_FontInfo;
45
46/* Initializes the font */
47/* Font: this contains the suface with the font. */
48/*       The font must be loaded before using this function. */
49void InitFont (SDL_Surface *Font);
50void InitFont2(SFont_FontInfo *Font);
51
52/* Blits a string to a surface */
53/* Destination: the suface you want to blit to */
54/* text: a string containing the text you want to blit. */
55void PutString (SDL_Surface *Surface, int x, int y, char *text);
56void PutString2(SDL_Surface *Surface, SFont_FontInfo *Font, int x, int y, char *text);
57
58/* Returns the width of "text" in pixels */
59#ifdef MACOSX
60int SFont_TextWidth(char *text);
61int SFont_TextWidth2(SFont_FontInfo *Font, char *text);
62#else
63int TextWidth(char *text);
64int TextWidth2(SFont_FontInfo *Font, char *text);
65#endif
66
67/* Blits a string to with centered x position */
68void XCenteredString (SDL_Surface *Surface, int y, char *text);
69void XCenteredString2(SDL_Surface *Surface, SFont_FontInfo *Font, int y, char *text);
70
71/* Allows the user to enter text */
72/* Width: What is the maximum width of the text (in pixels) */
73/* text: This string contains the text which was entered by the user */
74void SFont_Input ( SDL_Surface *Destination, int x, int y, int Width, char *text);
75void SFont_Input2( SDL_Surface *Destination, SFont_FontInfo *Font, int x, int y, int Width, char *text);
76
77#ifdef __cplusplus
78}
79#endif