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