Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/nico/src/sfont/sfont.h @ 4010

Last change on this file since 4010 was 3399, checked in by bensch, 20 years ago

orxonox/branches/nico: merged trunk into branches/nico
merged with command:
svn merge ../trunk/ nico/ -r 3238:HEAD
resolved conflict in favor of branches/nico.

File size: 3.4 KB
Line 
1/*  SFont: a simple font-library that uses special bitmaps as fonts
2    Copyright (C) 2003 Karl Bartel
3
4    License: GPL or LGPL (at your choice)
5    WWW: http://www.linux-games.com/sfont/
6
7    This program is free software; you can redistribute it and/or modify       
8    it under the terms of the GNU General Public License as published by       
9    the Free Software Foundation; either version 2 of the License, or           
10    (at your option) any later version.                                         
11                                                                               
12    This program is distributed in the hope that it will be useful,       
13    but WITHOUT ANY WARRANTY; without even the implied warranty of             
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               
15    GNU General Public License for more details.               
16                                                                               
17    You should have received a copy of the GNU General Public License           
18    along with this program; if not, write to the Free Software                 
19    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   
20                                                                               
21    Karl Bartel
22    Cecilienstr. 14                                                   
23    12307 Berlin
24    GERMANY
25    karlb@gmx.net                                                     
26*/                                                                           
27
28/************************************************************************
29*    SFONT - SDL Font Library by Karl Bartel <karlb@gmx.net>            *
30*                                                                       *
31*  All functions are explained below. For further information, take a   *
32*  look at the example files, the links at the SFont web site, or       *
33*  contact me, if you problem isn' addressed anywhere.                  *
34*                                                                       *
35************************************************************************/
36#ifndef SFONT_H
37#define SFONT_H
38
39#include <SDL.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45// Delcare one variable of this type for each font you are using.
46// To load the fonts, load the font image into YourFont->Surface
47// and call InitFont( YourFont );
48typedef struct {
49        SDL_Surface *Surface;   
50        int CharPos[512];
51        int MaxPos;
52} SFont_Font;
53
54// Initializes the font
55// Font: this contains the suface with the font.
56//       The Surface must be loaded before calling this function
57SFont_Font* SFont_InitFont (SDL_Surface *Font);
58
59// Frees the font
60// Font: The font to free
61//       The font must be loaded before using this function.
62void SFont_FreeFont(SFont_Font* Font);
63
64// Blits a string to a surface
65// Destination: the suface you want to blit to
66// text: a string containing the text you want to blit.
67void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font, int x, int y,
68                                 const char *text);
69
70// Returns the width of "text" in pixels
71int SFont_TextWidth(const SFont_Font* Font, const char *text);
72// Returns the height of "text" in pixels (which is always equal to Font->Surface->h)
73int SFont_TextHeight(const SFont_Font* Font);
74
75// Blits a string to Surface with centered x position
76void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font* Font, int y,
77                                           const char *text);
78
79#ifdef __cplusplus
80}
81#endif
82
83#endif /* SFONT_H */
Note: See TracBrowser for help on using the repository browser.