]> icculus.org git repositories - btb/d2x.git/blob - ui/uidraw.c
move PhysicsFS initialisation, search path setup and argument reading to physfsx.h
[btb/d2x.git] / ui / uidraw.c
1 /* $Id: uidraw.c,v 1.4 2005-01-24 22:19:10 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: uidraw.c,v 1.4 2005-01-24 22:19:10 schaffner Exp $";
17 #endif
18
19 #ifdef HAVE_CONFIG_H
20 #include "conf.h"
21 #endif
22
23 #include "fix.h"
24 #include "pstypes.h"
25 #include "gr.h"
26 #include "ui.h"
27
28 void Hline(short x1, short x2, short y )
29 {
30         gr_uscanline( x1, x2, y );
31 }
32
33 void Vline(short y1, short y2, short x )
34 {
35         for ( ; y1 <= y2; y1++ )
36                 gr_upixel( x, y1 );
37 }
38
39 void ui_string_centered( short x, short y, char * s )
40 {
41         int height, width, avg;
42
43         gr_get_string_size(s, &width, &height, &avg );
44
45         //baseline = height-grd_curcanv->cv_font->ft_baseline;
46
47         gr_ustring(x-((width-1)/2), y-((height-1)/2), s );
48
49 }
50
51
52 void ui_draw_shad( short x1, short y1, short x2, short y2, short c1, short c2 )
53 {
54         gr_setcolor( c1 );
55
56         Hline( x1+0, x2-1, y1+0 );
57         Vline( y1+1, y2+0, x1+0 );
58
59         gr_setcolor( c2 );
60         Hline( x1+1, x2, y2-0 );
61         Vline( y1+0, y2-1, x2-0 );
62 }
63
64 void ui_draw_frame( short x1, short y1, short x2, short y2 )
65 {
66
67         ui_draw_shad( x1+0, y1+0, x2-0, y2-0, CBRIGHT, CGREY );
68         ui_draw_shad( x1+1, y1+1, x2-1, y2-1, CBRIGHT, CGREY );
69
70         ui_draw_shad( x1+2, y1+2, x2-2, y2-2, CWHITE, CWHITE );
71         ui_draw_shad( x1+3, y1+3, x2-3, y2-3, CWHITE, CWHITE );
72         ui_draw_shad( x1+4, y1+4, x2-4, y2-4, CWHITE, CWHITE );
73         ui_draw_shad( x1+5, y1+5, x2-5, y2-5, CWHITE, CWHITE );
74
75         ui_draw_shad( x1+6, y1+6, x2-6, y2-6, CGREY, CBRIGHT );
76         ui_draw_shad( x1+7, y1+7, x2-7, y2-7, CGREY, CBRIGHT );
77
78 }
79
80
81
82
83
84 void ui_draw_box_out( short x1, short y1, short x2, short y2 )
85 {
86
87         gr_setcolor( CWHITE );
88         gr_urect( x1+2, y1+2, x2-2, y2-2 );
89
90         ui_draw_shad( x1+0, y1+0, x2-0, y2-0, CBRIGHT, CGREY );
91         ui_draw_shad( x1+1, y1+1, x2-1, y2-1, CBRIGHT, CGREY );
92
93 }
94
95 void ui_draw_box_in( short x1, short y1, short x2, short y2 )
96 {
97
98         gr_setcolor( CWHITE );
99         gr_urect( x1+2, y1+2, x2-2, y2-2 );
100
101         ui_draw_shad( x1+0, y1+0, x2-0, y2-0, CGREY, CBRIGHT );
102         ui_draw_shad( x1+1, y1+1, x2-1, y2-1, CGREY, CBRIGHT );
103 }
104
105
106 void ui_draw_line_in( short x1, short y1, short x2, short y2 )
107 {
108         gr_setcolor( CGREY );
109         Hline( x1, x2, y1 );
110         Hline( x1, x2-1, y2-1 );
111         Vline( y1+1, y2-2, x1 );
112         Vline( y1+1, y2-2, x2-1 );
113
114         gr_setcolor( CBRIGHT );
115         Hline( x1+1, x2-1, y1+1 );
116         Hline( x1, x2, y2 );
117         Vline( y1+2, y2-2, x1+1 );
118         Vline( y1+1, y2-1, x2 );
119
120 }
121
122
123
124
125