Pass color to gr_urect
This commit is contained in:
parent
f235d6b12b
commit
35a4736df0
|
@ -33,9 +33,8 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
|
||||
namespace dcx {
|
||||
|
||||
void gr_urect(int left,int top,int right,int bot)
|
||||
void gr_urect(int left,int top,int right,int bot, const uint8_t color)
|
||||
{
|
||||
const auto color = COLOR;
|
||||
#ifdef OGL
|
||||
if (TYPE == BM_OGL) {
|
||||
ogl_urect(left,top,right,bot, color);
|
||||
|
|
|
@ -219,7 +219,7 @@ void gr_ubitmapm(unsigned x, unsigned y, grs_bitmap &bm);
|
|||
|
||||
// Draw a rectangle into the current canvas.
|
||||
void gr_rect(int left,int top,int right,int bot);
|
||||
void gr_urect(int left,int top,int right,int bot);
|
||||
void gr_urect(int left,int top,int right,int bot, uint8_t color);
|
||||
|
||||
// Draw a filled circle
|
||||
int gr_disk(fix x,fix y,fix r);
|
||||
|
|
|
@ -37,8 +37,9 @@ namespace dcx {
|
|||
static void ui_draw_box_in1( short x1, short y1, short x2, short y2 )
|
||||
{
|
||||
|
||||
const uint8_t color = CWHITE;
|
||||
gr_setcolor( CWHITE );
|
||||
gr_urect( x1+1, y1+1, x2-1, y2-1 );
|
||||
gr_urect(x1+1, y1+1, x2-1, y2-1, color);
|
||||
|
||||
ui_draw_shad( x1+0, y1+0, x2-0, y2-0, CGREY, CBRIGHT );
|
||||
}
|
||||
|
|
|
@ -273,8 +273,9 @@ void ui_pad_draw(UI_DIALOG *dlg, int x, int y)
|
|||
ui_draw_box_in( x, y, x+(bw*4)+10 + 200, y+(bh*5)+45 );
|
||||
|
||||
gr_set_current_canvas( NULL );
|
||||
const uint8_t color = CWHITE;
|
||||
gr_setcolor( CWHITE );
|
||||
gr_urect( desc_x, desc_y, desc_x+ 56*4-1, desc_y+15 );
|
||||
gr_urect( desc_x, desc_y, desc_x+ 56*4-1, desc_y+15, color);
|
||||
gr_set_fontcolor( CBLACK, CWHITE );
|
||||
gr_ustring(desc_x, desc_y, KeyPad[active_pad]->description.data());
|
||||
}
|
||||
|
|
|
@ -85,8 +85,9 @@ static void item_show( MENU * menu, int n )
|
|||
// If this is a seperator, then draw it.
|
||||
if ( item->Text[0] == '-' )
|
||||
{
|
||||
const uint8_t color = CBLACK;
|
||||
gr_setcolor( CBLACK );
|
||||
gr_urect( item->x, item->y+item->h/2, item->x+item->w-1, item->y+item->h/2 );
|
||||
gr_urect( item->x, item->y+item->h/2, item->x+item->w-1, item->y+item->h/2, color);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -94,15 +95,17 @@ static void item_show( MENU * menu, int n )
|
|||
{
|
||||
if ( menu != &Menu[0] )
|
||||
{
|
||||
const uint8_t color = CBLACK;
|
||||
gr_setcolor( CBLACK );
|
||||
gr_urect( item->x+1, item->y+1, item->x+menu->w-2, item->y+item->h-2 );
|
||||
gr_urect( item->x+1, item->y+1, item->x+menu->w-2, item->y+item->h-2, color);
|
||||
}
|
||||
gr_set_fontcolor( CWHITE, CBLACK );
|
||||
}else {
|
||||
if ( menu != &Menu[0] )
|
||||
{
|
||||
const uint8_t color = CGREY;
|
||||
gr_setcolor( CGREY );
|
||||
gr_urect( item->x+1, item->y+1, item->x+menu->w-2, item->y+item->h-2 );
|
||||
gr_urect( item->x+1, item->y+1, item->x+menu->w-2, item->y+item->h-2, color);
|
||||
}
|
||||
gr_set_fontcolor( CBLACK, CGREY );
|
||||
}
|
||||
|
@ -129,7 +132,7 @@ static void menu_draw(MENU *menu)
|
|||
|
||||
// Draw the menu background
|
||||
gr_setcolor( CGREY );
|
||||
gr_urect( menu->x, menu->y, menu->x + menu->w - 1, menu->y + menu->h - 1 );
|
||||
gr_urect( menu->x, menu->y, menu->x + menu->w - 1, menu->y + menu->h - 1, CGREY);
|
||||
if ( menu != &Menu[0] )
|
||||
{
|
||||
gr_setcolor( CBLACK );
|
||||
|
|
|
@ -85,8 +85,9 @@ 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 )
|
||||
{
|
||||
|
||||
const uint8_t color = CWHITE;
|
||||
gr_setcolor( CWHITE );
|
||||
gr_urect( x1+2, y1+2, x2-2, y2-2 );
|
||||
gr_urect( x1+2, y1+2, x2-2, y2-2, color);
|
||||
|
||||
ui_draw_shad( x1+0, y1+0, x2-0, y2-0, CBRIGHT, CGREY );
|
||||
ui_draw_shad( x1+1, y1+1, x2-1, y2-1, CBRIGHT, CGREY );
|
||||
|
@ -97,7 +98,6 @@ void ui_draw_box_in( short x1, short y1, short x2, short y2 )
|
|||
{
|
||||
|
||||
gr_setcolor( CWHITE );
|
||||
// gr_urect( x1+2, y1+2, x2-2, y2-2 );
|
||||
|
||||
ui_draw_shad( x1+0, y1+0, x2-0, y2-0, CGREY, CBRIGHT );
|
||||
ui_draw_shad( x1+1, y1+1, x2-1, y2-1, CGREY, CBRIGHT );
|
||||
|
|
|
@ -1323,6 +1323,7 @@ static void kc_drawinput(const kc_item &item, kc_mitem& mitem, int is_current, c
|
|||
const char *btext;
|
||||
const auto &&fspacx = FSPACX();
|
||||
const auto &&fspacy = FSPACY();
|
||||
unsigned r, g, b;
|
||||
if (label)
|
||||
{
|
||||
gr_set_fontcolor(is_current ? BM_XRGB(20, 20, 29) : BM_XRGB(15, 15, 24), -1 );
|
||||
|
@ -1333,11 +1334,16 @@ static void kc_drawinput(const kc_item &item, kc_mitem& mitem, int is_current, c
|
|||
if (!btext)
|
||||
return;
|
||||
{
|
||||
gr_setcolor(is_current ? BM_XRGB(21, 0, 24) : BM_XRGB(16, 0, 19));
|
||||
if (is_current)
|
||||
r = 21 * 2, g = 0, b = 24 * 2;
|
||||
else
|
||||
r = 16 * 2, g = 0, b = 19 * 2;
|
||||
const uint8_t color = BM_XRGB(r, g, b);
|
||||
gr_setcolor(color);
|
||||
|
||||
int x, w, h;
|
||||
gr_get_string_size(btext, &w, &h, nullptr);
|
||||
gr_urect(fspacx(item.xinput), fspacy(item.y - 1), fspacx(item.xinput + item.w2), fspacy(item.y) + h);
|
||||
gr_urect(fspacx(item.xinput), fspacy(item.y - 1), fspacx(item.xinput + item.w2), fspacy(item.y) + h, color);
|
||||
|
||||
gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
|
||||
|
||||
|
@ -1353,12 +1359,11 @@ static void kc_drawquestion( kc_menu *menu, const kc_item *item )
|
|||
int x;
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
int c = BM_XRGB(21,0,24);
|
||||
|
||||
gr_setcolor( gr_fade_table[fades[menu->q_fade_i]][c] );
|
||||
const uint8_t color = gr_fade_table[fades[menu->q_fade_i]][BM_XRGB(21,0,24)];
|
||||
#elif defined(DXX_BUILD_DESCENT_II)
|
||||
gr_setcolor(BM_XRGB(21*fades[menu->q_fade_i]/31,0,24*fades[menu->q_fade_i]/31));
|
||||
const uint8_t color = BM_XRGB(21*fades[menu->q_fade_i]/31,0,24*fades[menu->q_fade_i]/31);
|
||||
#endif
|
||||
gr_setcolor(color);
|
||||
menu->q_fade_i++;
|
||||
if (menu->q_fade_i>63) menu->q_fade_i=0;
|
||||
|
||||
|
@ -1367,7 +1372,7 @@ static void kc_drawquestion( kc_menu *menu, const kc_item *item )
|
|||
int w, h;
|
||||
gr_get_string_size("?", &w, &h, nullptr);
|
||||
|
||||
gr_urect(fspacx(item->xinput), fspacy(item->y - 1), fspacx(item->xinput + item->w2), fspacy(item->y) + h);
|
||||
gr_urect(fspacx(item->xinput), fspacy(item->y - 1), fspacx(item->xinput + item->w2), fspacy(item->y) + h, color);
|
||||
|
||||
gr_set_fontcolor( BM_XRGB(28,28,28), -1 );
|
||||
|
||||
|
|
|
@ -194,12 +194,18 @@ void nm_draw_background(int x1, int y1, int x2, int y2 )
|
|||
gr_set_current_canvas(old);
|
||||
|
||||
gr_settransblend(14, GR_BLEND_NORMAL);
|
||||
gr_setcolor( BM_XRGB(1,1,1) );
|
||||
{
|
||||
const uint8_t color = BM_XRGB(1, 1, 1);
|
||||
gr_setcolor(color);
|
||||
for (w=5*BGScaleX;w>0;w--)
|
||||
gr_urect( x2-w, y1+w*(BGScaleY/BGScaleX), x2-w, y2-w*(BGScaleY/BGScaleX) );//right edge
|
||||
gr_setcolor( BM_XRGB(0,0,0) );
|
||||
gr_urect( x2-w, y1+w*(BGScaleY/BGScaleX), x2-w, y2-w*(BGScaleY/BGScaleX), color);//right edge
|
||||
}
|
||||
{
|
||||
const uint8_t color = BM_XRGB(0, 0, 0);
|
||||
gr_setcolor(color);
|
||||
for (h=5*BGScaleY;h>0;h--)
|
||||
gr_urect( x1+h*(BGScaleX/BGScaleY), y2-h, x2-h*(BGScaleX/BGScaleY), y2-h );//bottom edge
|
||||
gr_urect( x1+h*(BGScaleX/BGScaleY), y2-h, x2-h*(BGScaleX/BGScaleY), y2-h, color);//bottom edge
|
||||
}
|
||||
gr_settransblend(GR_FADE_OFF, GR_BLEND_NORMAL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue