configuration fixes
[btb/d2x.git] / main / gamefont.c
1 /*
2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13
14
15 #ifdef RCS
16 static char rcsid[] = "$Id: gamefont.c,v 1.1.1.1 2001-01-19 03:30:04 bradleyb Exp $";
17 #endif
18
19 #include <conf.h>
20 #include <stdlib.h>
21
22 #include "inferno.h"
23 #include "gr.h"
24 #include "gamefont.h"
25
26 //if 1, use high-res versions of fonts
27 int FontHires=0;
28
29 char * Gamefont_filenames[] = { "font1-1.fnt",                  // Font 0
30                                                                                         "font1-1h.fnt",         // Font 0 High-res
31                                                                                         "font2-1.fnt",                  // Font 1
32                                                                                         "font2-1h.fnt",         // Font 1 High-res
33                                                                                         "font2-2.fnt",                  // Font 2
34                                                                                         "font2-2h.fnt",         // Font 2 High-res
35                                                                                         "font2-3.fnt",                  // Font 3
36                                                                                         "font2-3h.fnt",         // Font 3 High-res
37                                                                                         "font3-1.fnt",                  // Font 4
38                                                                                         "font3-1h.fnt",         // Font 4 High-res
39                                                                                 };
40
41 grs_font *Gamefonts[MAX_FONTS];
42
43 int Gamefont_installed=0;
44
45 void gamefont_init()
46 {
47         int i;
48
49         if (Gamefont_installed) return;
50         Gamefont_installed = 1;
51
52         for (i=0; i<MAX_FONTS; i++ )
53                 Gamefonts[i] = gr_init_font(Gamefont_filenames[i]);
54
55         atexit( gamefont_close );
56 }
57
58
59 void gamefont_close()
60 {
61         int i;
62
63         if (!Gamefont_installed) return;
64         Gamefont_installed = 0;
65
66         for (i=0; i<MAX_FONTS; i++ )    {
67                 gr_close_font( Gamefonts[i] );
68                 Gamefonts[i] = NULL;
69         }
70
71 }