From 76e770217095fa7b42e62ddbd4e09e369d43bec1 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 25 May 2006 21:26:13 +0000 Subject: Allow the fg/bg colors to be set on labels. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 529 --- textscreen/txt_label.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'textscreen/txt_label.c') diff --git a/textscreen/txt_label.c b/textscreen/txt_label.c index a6ac8293..7a8658f9 100644 --- a/textscreen/txt_label.c +++ b/textscreen/txt_label.c @@ -18,18 +18,23 @@ static void TXT_LabelSizeCalc(TXT_UNCAST_ARG(label), int *w, int *h) static void TXT_LabelDrawer(TXT_UNCAST_ARG(label), int w, int selected) { TXT_CAST_ARG(txt_label_t, label); - int i; + int x, y; int origin_x, origin_y; - TXT_BGColor(TXT_COLOR_BLUE, 0); - TXT_FGColor(TXT_COLOR_BRIGHT_WHITE); + TXT_BGColor(label->bgcolor, 0); + TXT_FGColor(label->fgcolor); TXT_GetXY(&origin_x, &origin_y); - for (i=0; ih; ++i) + for (y=0; yh; ++y) { - TXT_GotoXY(origin_x, origin_y + i); - TXT_DrawString(label->lines[i]); + TXT_GotoXY(origin_x, origin_y + y); + TXT_DrawString(label->lines[y]); + + for (x=strlen(label->lines[y]); xlabel = NULL; label->lines = NULL; + // Default colors + + label->bgcolor = TXT_COLOR_BLUE; + label->fgcolor = TXT_COLOR_BRIGHT_WHITE; + TXT_SetLabel(label, text); return label; } +void TXT_SetFGColor(txt_label_t *label, txt_color_t color) +{ + label->fgcolor = color; +} + +void TXT_SetBGColor(txt_label_t *label, txt_color_t color) +{ + label->bgcolor = color; +} + -- cgit v1.2.3