Pass color to Hline

This commit is contained in:
Kp 2016-02-12 04:02:28 +00:00
parent d08bfc3170
commit 76d0e01b6e
4 changed files with 17 additions and 24 deletions

View file

@ -232,9 +232,9 @@ extern grs_font_ptr ui_small_font;
extern unsigned char CBLACK,CGREY,CWHITE,CBRIGHT,CRED;
extern UI_GADGET * selected_gadget;
#define Hline(x1,x2,y) Hline(x1,y,x2)
#define Hline(x1,x2,y,c) Hline(x1,y,x2,c)
#define Vline(y1,y2,x) Vline(x,y1,y2)
extern void Hline(short x1, short x2, short y );
void Hline(short x1, short x2, short y, uint8_t color);
extern void Vline(short y1, short y2, short x );
extern void ui_string_centered( short x, short y, const char * s );
extern void ui_draw_box_out( short x1, short y1, short x2, short y2 );

View file

@ -109,13 +109,14 @@ void ui_draw_listbox( UI_DIALOG *dlg, UI_GADGET_LISTBOX * listbox )
static void gr_draw_sunken_border( short x1, short y1, short x2, short y2 )
{
const uint8_t cgrey = CGREY;
const uint8_t cbright = CBRIGHT;
gr_setcolor( CGREY );
Hline( x1-1, x2+1, y1-1);
Hline(x1-1, x2+1, y1-1, cgrey);
Vline( y1-1, y2+1, x1-1);
gr_setcolor( CBRIGHT );
Hline( x1-1, x2+1, y2+1);
Hline(x1-1, x2+1, y2+1, cbright);
Vline( y1, y2+1, x2+1);
}

View file

@ -77,10 +77,10 @@ static int messagebox_handler(UI_DIALOG *dlg,const d_event &event, messagebox *m
ui_string_centered( m->width/2, m->text_y, m->text );
gr_setcolor( CGREY );
Hline(1, m->width-2, m->line_y+1 );
Hline(1, m->width-2, m->line_y+1, CGREY);
gr_setcolor( CBRIGHT );
Hline(2, m->width-2, m->line_y+2 );
Hline(2, m->width-2, m->line_y+2, CBRIGHT);
grd_curscreen->sc_canvas.cv_font = temp_font;

View file

@ -25,9 +25,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
namespace dcx {
void Hline(short x1, short x2, short y )
void Hline(short x1, short x2, short y, const uint8_t color)
{
const auto color = grd_curcanv->cv_color;
gr_uline(i2f(x1), i2f(y), i2f(x2), i2f(y), color);
}
@ -54,11 +53,11 @@ void ui_draw_shad( short x1, short y1, short x2, short y2, short c1, short c2 )
{
gr_setcolor( c1 );
Hline( x1+0, x2-1, y1+0 );
Hline(x1+0, x2-1, y1+0, c1);
Vline( y1+1, y2+0, x1+0 );
gr_setcolor( c2 );
Hline( x1+1, x2, y2-0 );
Hline(x1+1, x2, y2-0, c2);
Vline( y1+0, y2-1, x2-0 );
}
@ -78,10 +77,6 @@ void ui_draw_frame( short x1, short y1, short x2, short y2 )
}
void ui_draw_box_out( short x1, short y1, short x2, short y2 )
{
@ -103,25 +98,22 @@ void ui_draw_box_in( short x1, short y1, short x2, short y2 )
ui_draw_shad( x1+1, y1+1, x2-1, y2-1, CGREY, CBRIGHT );
}
void ui_draw_line_in( short x1, short y1, short x2, short y2 )
{
const uint8_t cgrey = CGREY;
const uint8_t cbright = CBRIGHT;
gr_setcolor( CGREY );
Hline( x1, x2, y1 );
Hline( x1, x2-1, y2-1 );
Hline(x1, x2, y1, cgrey);
Hline(x1, x2-1, y2-1, cgrey);
Vline( y1+1, y2-2, x1 );
Vline( y1+1, y2-2, x2-1 );
gr_setcolor( CBRIGHT );
Hline( x1+1, x2-1, y1+1 );
Hline( x1, x2, y2 );
Hline(x1+1, x2-1, y1+1, cbright);
Hline(x1, x2, y2, cbright);
Vline( y1+2, y2-2, x1+1 );
Vline( y1+1, y2-1, x2 );
}
}