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