]> icculus.org git repositories - btb/d2x.git/blob - unused/ui/ui.c
replace byte with sbyte
[btb/d2x.git] / unused / 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 #pragma off (unreferenced)
15 static char rcsid[] = "$Id: ui.c,v 1.1.1.1 2001-01-19 03:30:15 bradleyb Exp $";
16 #pragma on (unreferenced)
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <stdarg.h>
20 #include <string.h>
21 #include <dos.h>
22
23 #include "fix.h"
24 #include "types.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 extern void InstallErrorHandler();
34
35 static int Initialized = 0;
36
37 unsigned char CBLACK,CGREY,CWHITE,CBRIGHT,CRED;
38
39 grs_font * ui_small_font = NULL;
40
41 void ui_init()
42 {
43         grs_font * org_font;
44
45         if (Initialized) return;
46
47         Initialized = 1;
48
49         org_font = grd_curcanv->cv_font;
50         ui_small_font = gr_init_font( "pc6x8.fnt" );
51         grd_curcanv->cv_font =org_font;
52
53         CBLACK = gr_find_closest_color( 1, 1, 1 );
54         CGREY = gr_find_closest_color( 45, 45, 45 );
55         CWHITE = gr_find_closest_color( 50, 50, 50 );
56         CBRIGHT = gr_find_closest_color( 58, 58, 58 );
57         CRED = gr_find_closest_color( 63, 0, 0 );
58
59         //key_init();
60
61         ui_mouse_init();
62
63         gr_set_fontcolor( CBLACK, CWHITE );
64
65         CurWindow = NULL;
66
67         InstallErrorHandler();
68
69         ui_pad_init();
70         
71         atexit(ui_close );
72
73 }
74
75 void ui_close()
76 {
77         if (Initialized)
78         {
79                 Initialized = 0;
80
81                 ui_pad_close();
82
83                 ui_mouse_close();
84
85 //              mouse_close();
86 //      key_close();
87
88                 _harderr( NULL );
89
90                 gr_close_font( ui_small_font );
91
92         }
93
94         return;
95 }
96