2 * $Logfile: /Freespace2/code/UI/UIDRAW.cpp $
7 * Routines to draw UI sort of stuff.
10 * Revision 1.1 2002/05/03 03:28:11 root
14 * 3 10/13/98 9:29a Dave
15 * Started neatening up freespace.h. Many variables renamed and
16 * reorganized. Added AlphaColors.[h,cpp]
18 * 2 10/07/98 10:54a Dave
21 * 1 10/07/98 10:51a Dave
23 * 4 3/10/98 4:19p John
24 * Cleaned up graphics lib. Took out most unused gr functions. Made D3D
25 * & Glide have popups and print screen. Took out all >8bpp software
26 * support. Made Fred zbuffer. Made zbuffer allocate dynamically to
27 * support Fred. Made zbuffering key off of functions rather than one
30 * 3 2/03/98 4:21p Hoffoss
31 * Made UI controls draw white text when disabled.
33 * 2 6/11/97 1:13p John
34 * Started fixing all the text colors in the game.
36 * 1 11/14/96 6:55p John
43 #include "alphacolors.h"
45 void ui_hline(int x1, int x2, int y )
50 void ui_vline(int y1, int y2, int x )
55 void ui_string_centered( int x, int y, char * s )
59 gr_get_string_size( &width, &height, s );
61 //baseline = height-grd_curcanv->cv_font->ft_baseline;
63 gr_string(x-((width-1)/2), y-((height-1)/2), s );
67 void ui_draw_shad( int x1, int y1, int x2, int y2, color * c1, color *c2 )
69 gr_set_color_fast( c1 );
71 ui_hline( x1+0, x2-1, y1+0 );
72 ui_vline( y1+1, y2+0, x1+0 );
74 gr_set_color_fast( c2 );
75 ui_hline( x1+1, x2, y2-0 );
76 ui_vline( y1+0, y2-1, x2-0 );
79 void ui_draw_frame( int x1, int y1, int x2, int y2 )
81 ui_draw_shad( x1+0, y1+0, x2-0, y2-0, &CBRIGHT, &CGRAY );
82 ui_draw_shad( x1+1, y1+1, x2-1, y2-1, &CBRIGHT, &CGRAY );
84 ui_draw_shad( x1+2, y1+2, x2-2, y2-2, &CWHITE, &CWHITE );
85 ui_draw_shad( x1+3, y1+3, x2-3, y2-3, &CWHITE, &CWHITE );
86 ui_draw_shad( x1+4, y1+4, x2-4, y2-4, &CWHITE, &CWHITE );
87 ui_draw_shad( x1+5, y1+5, x2-5, y2-5, &CWHITE, &CWHITE );
89 ui_draw_shad( x1+6, y1+6, x2-6, y2-6, &CGRAY, &CBRIGHT );
90 ui_draw_shad( x1+7, y1+7, x2-7, y2-7, &CGRAY, &CBRIGHT );
93 void ui_rect( int x1, int y1, int x2, int y2 )
95 gr_rect( x1, y1, x2-x1+1, y2-y1+1 );
100 void ui_draw_box_out( int x1, int y1, int x2, int y2 )
103 gr_set_color_fast( &CWHITE );
104 gr_rect( x1+2, y1+2, (x2-2)-(x1+2)+1, (y2-2)-(y1+2)+1 );
106 ui_draw_shad( x1+0, y1+0, x2-0, y2-0, &CBRIGHT, &CGRAY );
107 ui_draw_shad( x1+1, y1+1, x2-1, y2-1, &CBRIGHT, &CGRAY );
111 void ui_draw_box_in( int x1, int y1, int x2, int y2 )
114 gr_set_color_fast( &CWHITE );
115 gr_rect( x1+2, y1+2, (x2-2)-(x1+2)+1, (y2-2)-(y1+2)+1 );
117 ui_draw_shad( x1+0, y1+0, x2-0, y2-0, &CGRAY, &CBRIGHT );
118 ui_draw_shad( x1+1, y1+1, x2-1, y2-1, &CGRAY, &CBRIGHT );
122 void ui_draw_line_in( int x1, int y1, int x2, int y2 )
124 gr_set_color_fast( &CGRAY );
125 ui_hline( x1, x2, y1 );
126 ui_hline( x1, x2-1, y2-1 );
127 ui_vline( y1+1, y2-2, x1 );
128 ui_vline( y1+1, y2-2, x2-1 );
130 gr_set_color_fast( &CBRIGHT );
131 ui_hline( x1+1, x2-1, y1+1 );
132 ui_hline( x1, x2, y2 );
133 ui_vline( y1+2, y2-2, x1+1 );
134 ui_vline( y1+1, y2-1, x2 );
137 void ui_draw_sunken_border( int x1, int y1, int x2, int y2 )
140 gr_set_color_fast( &CGRAY );
141 ui_hline( x1-1, x2+1, y1-1);
142 ui_vline( y1-1, y2+1, x1-1);
144 gr_set_color_fast( &CBRIGHT );
145 ui_hline( x1-1, x2+1, y2+1);
146 ui_vline( y1, y2+1, x2+1);