]> icculus.org git repositories - btb/d2x.git/blob - ui/ui.c
remove rcs tags
[btb/d2x.git] / ui / ui.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 #ifdef HAVE_CONFIG_H
15 #include "conf.h"
16 #endif
17
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <stdarg.h>
21 #include <string.h>
22
23 #include "fix.h"
24 #include "pstypes.h"
25 #include "gr.h"
26 #include "key.h"
27 #include "ui.h"
28
29 #include "mouse.h"
30
31 #include "mono.h"
32
33 static int Initialized = 0;
34
35 unsigned char CBLACK,CGREY,CWHITE,CBRIGHT,CRED;
36
37 grs_font * ui_small_font = NULL;
38
39 void ui_init()
40 {
41         grs_font * org_font;
42
43         if (Initialized) return;
44
45         Initialized = 1;
46
47         org_font = grd_curcanv->cv_font;
48         ui_small_font = gr_init_font( "pc6x8.fnt" );
49         grd_curcanv->cv_font =org_font;
50
51         CBLACK = gr_find_closest_color( 1, 1, 1 );
52         CGREY = gr_find_closest_color( 45, 45, 45 );
53         CWHITE = gr_find_closest_color( 50, 50, 50 );
54         CBRIGHT = gr_find_closest_color( 58, 58, 58 );
55         CRED = gr_find_closest_color( 63, 0, 0 );
56
57         //key_init();
58
59         ui_mouse_init();
60
61         gr_set_fontcolor( CBLACK, CWHITE );
62
63         CurWindow = NULL;
64
65         ui_pad_init();
66         
67         atexit(ui_close );
68
69 }
70
71 void ui_close()
72 {
73         if (Initialized)
74         {
75                 Initialized = 0;
76
77                 ui_pad_close();
78
79                 ui_mouse_close();
80
81 //              mouse_close();
82 //      key_close();
83
84                 gr_close_font( ui_small_font );
85
86         }
87
88         return;
89 }
90