]> icculus.org git repositories - btb/d2x.git/blob - ui/ui.c
InstallErrorHandler() no longer exists, don't use it anymore
[btb/d2x.git] / ui / ui.c
1  /* $Id: ui.c,v 1.5 2005-01-25 19:57:40 schaffner Exp $ */
2 /*
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
13 */
14
15 #ifdef RCS
16 static char rcsid[] = "$Id: ui.c,v 1.5 2005-01-25 19:57:40 schaffner Exp $";
17 #endif
18
19 #ifdef HAVE_CONFIG_H
20 #include "conf.h"
21 #endif
22
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <stdarg.h>
26 #include <string.h>
27 #include <dos.h>
28
29 #include "fix.h"
30 #include "pstypes.h"
31 #include "gr.h"
32 #include "key.h"
33 #include "ui.h"
34
35 #include "mouse.h"
36
37 #include "mono.h"
38
39 static int Initialized = 0;
40
41 unsigned char CBLACK,CGREY,CWHITE,CBRIGHT,CRED;
42
43 grs_font * ui_small_font = NULL;
44
45 void ui_init()
46 {
47         grs_font * org_font;
48
49         if (Initialized) return;
50
51         Initialized = 1;
52
53         org_font = grd_curcanv->cv_font;
54         ui_small_font = gr_init_font( "pc6x8.fnt" );
55         grd_curcanv->cv_font =org_font;
56
57         CBLACK = gr_find_closest_color( 1, 1, 1 );
58         CGREY = gr_find_closest_color( 45, 45, 45 );
59         CWHITE = gr_find_closest_color( 50, 50, 50 );
60         CBRIGHT = gr_find_closest_color( 58, 58, 58 );
61         CRED = gr_find_closest_color( 63, 0, 0 );
62
63         //key_init();
64
65         ui_mouse_init();
66
67         gr_set_fontcolor( CBLACK, CWHITE );
68
69         CurWindow = NULL;
70
71         ui_pad_init();
72         
73         atexit(ui_close );
74
75 }
76
77 void ui_close()
78 {
79         if (Initialized)
80         {
81                 Initialized = 0;
82
83                 ui_pad_close();
84
85                 ui_mouse_close();
86
87 //              mouse_close();
88 //      key_close();
89
90                 gr_close_font( ui_small_font );
91
92         }
93
94         return;
95 }
96