]> icculus.org git repositories - btb/d2x.git/blob - ui/ui.c
use qsort and file_sort_func instead of file_sort
[btb/d2x.git] / ui / ui.c
1  /* $Id: ui.c,v 1.6 2005-02-26 00:47:08 chris 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.6 2005-02-26 00:47:08 chris 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
28 #include "fix.h"
29 #include "pstypes.h"
30 #include "gr.h"
31 #include "key.h"
32 #include "ui.h"
33
34 #include "mouse.h"
35
36 #include "mono.h"
37
38 static int Initialized = 0;
39
40 unsigned char CBLACK,CGREY,CWHITE,CBRIGHT,CRED;
41
42 grs_font * ui_small_font = NULL;
43
44 void ui_init()
45 {
46         grs_font * org_font;
47
48         if (Initialized) return;
49
50         Initialized = 1;
51
52         org_font = grd_curcanv->cv_font;
53         ui_small_font = gr_init_font( "pc6x8.fnt" );
54         grd_curcanv->cv_font =org_font;
55
56         CBLACK = gr_find_closest_color( 1, 1, 1 );
57         CGREY = gr_find_closest_color( 45, 45, 45 );
58         CWHITE = gr_find_closest_color( 50, 50, 50 );
59         CBRIGHT = gr_find_closest_color( 58, 58, 58 );
60         CRED = gr_find_closest_color( 63, 0, 0 );
61
62         //key_init();
63
64         ui_mouse_init();
65
66         gr_set_fontcolor( CBLACK, CWHITE );
67
68         CurWindow = NULL;
69
70         ui_pad_init();
71         
72         atexit(ui_close );
73
74 }
75
76 void ui_close()
77 {
78         if (Initialized)
79         {
80                 Initialized = 0;
81
82                 ui_pad_close();
83
84                 ui_mouse_close();
85
86 //              mouse_close();
87 //      key_close();
88
89                 gr_close_font( ui_small_font );
90
91         }
92
93         return;
94 }
95