1
0
mirror of https://git.zap.org.au/git/trader.git synced 2024-12-04 14:46:45 -05:00

Add window attributes for the galaxy map

This commit is contained in:
John Zaitseff 2011-07-14 15:16:04 +10:00
parent 39d6bc5b37
commit 09d4455c3e
2 changed files with 26 additions and 15 deletions

View File

@ -101,14 +101,17 @@ void init_screen (void)
if (use_color) {
start_color();
init_pair(WHITE_ON_BLACK, COLOR_WHITE, COLOR_BLACK);
init_pair(WHITE_ON_BLUE, COLOR_WHITE, COLOR_BLUE);
init_pair(WHITE_ON_RED, COLOR_WHITE, COLOR_RED);
init_pair(BLACK_ON_WHITE, COLOR_BLACK, COLOR_WHITE);
init_pair(RED_ON_BLACK, COLOR_RED, COLOR_BLACK);
init_pair(CYAN_ON_BLUE, COLOR_CYAN, COLOR_BLUE);
init_pair(YELLOW_ON_BLACK, COLOR_YELLOW, COLOR_BLACK);
init_pair(YELLOW_ON_BLUE, COLOR_YELLOW, COLOR_BLUE);
init_pair(YELLOW_ON_CYAN, COLOR_YELLOW, COLOR_CYAN);
init_pair(CYAN_ON_BLUE, COLOR_CYAN, COLOR_BLUE);
init_pair(BLACK_ON_WHITE, COLOR_BLACK, COLOR_WHITE);
init_pair(GREEN_ON_BLACK, COLOR_GREEN, COLOR_BLACK);
init_pair(BLUE_ON_BLACK, COLOR_BLUE, COLOR_BLACK);
init_pair(WHITE_ON_BLACK, COLOR_WHITE, COLOR_BLACK);
init_pair(WHITE_ON_RED, COLOR_WHITE, COLOR_RED);
init_pair(WHITE_ON_BLUE, COLOR_WHITE, COLOR_BLUE);
bkgd(ATTR_ROOT_WINDOW);
}
@ -327,7 +330,7 @@ int center (WINDOW *win, int y, int attr, const char *format, ...)
}
oldattr = getbkgd(win) & ~A_CHARTEXT;
wbkgdset(win, A_NORMAL);
wbkgdset(win, A_NORMAL | (oldattr & A_COLOR));
wattrset(win, attr);
va_start(args, format);
@ -370,7 +373,7 @@ int attrpr (WINDOW *win, int attr, const char *format, ...)
oldattr = getbkgd(win) & ~A_CHARTEXT;
wbkgdset(win, A_NORMAL);
wbkgdset(win, A_NORMAL | (oldattr & A_COLOR));
wattrset(win, attr);
va_start(args, format);
@ -486,7 +489,7 @@ int gettxline (WINDOW *win, char *buf, int bufsize, bool multifield,
wtimeout(win, -1);
oldattr = getbkgd(win) & ~A_CHARTEXT;
wbkgdset(win, A_NORMAL);
wbkgdset(win, A_NORMAL | (oldattr & A_COLOR));
wattrset(win, attr & ~A_CHARTEXT);
curs_set(CURS_ON);
@ -1162,7 +1165,7 @@ bool answer_yesno (WINDOW *win)
wtimeout(win, -1);
oldattr = getbkgd(win) & ~A_CHARTEXT;
wbkgdset(win, A_NORMAL);
wbkgdset(win, A_NORMAL | (oldattr & A_COLOR));
wattron(win, A_BOLD);
curs_set(CURS_ON);
@ -1209,7 +1212,6 @@ void wait_for_key (WINDOW *win, int y, int attr)
meta(win, true);
wtimeout(win, -1);
curs_set(CURS_OFF);
center(win, y, attr, "[ Press <SPACE> to continue ] ");
wrefresh(win);

View File

@ -104,14 +104,17 @@ typedef enum curs_type {
// Colour pairs used in Star Traders
enum color_pairs {
DEFAULT_COLORS = 0,
WHITE_ON_BLACK,
WHITE_ON_BLUE,
WHITE_ON_RED,
BLACK_ON_WHITE,
RED_ON_BLACK,
CYAN_ON_BLUE,
YELLOW_ON_BLACK,
YELLOW_ON_BLUE,
YELLOW_ON_CYAN,
CYAN_ON_BLUE,
BLACK_ON_WHITE,
GREEN_ON_BLACK,
BLUE_ON_BLACK,
WHITE_ON_BLACK,
WHITE_ON_RED,
WHITE_ON_BLUE,
};
@ -119,6 +122,7 @@ enum color_pairs {
#define ATTR_GAME_TITLE ATTR(COLOR_PAIR(YELLOW_ON_CYAN) | A_BOLD, A_REVERSE | A_BOLD)
#define ATTR_ROOT_WINDOW ATTR(COLOR_PAIR(WHITE_ON_BLACK), A_NORMAL)
#define ATTR_NORMAL_WINDOW ATTR(COLOR_PAIR(WHITE_ON_BLUE), A_NORMAL)
#define ATTR_MAP_WINDOW ATTR(COLOR_PAIR(WHITE_ON_BLACK), A_NORMAL)
#define ATTR_STATUS_WINDOW ATTR(COLOR_PAIR(BLACK_ON_WHITE), A_REVERSE)
#define ATTR_ERROR_WINDOW ATTR(COLOR_PAIR(WHITE_ON_RED), A_REVERSE)
#define ATTR_WINDOW_TITLE ATTR(COLOR_PAIR(YELLOW_ON_BLACK) | A_BOLD, A_REVERSE)
@ -129,6 +133,11 @@ enum color_pairs {
#define ATTR_ERROR_STR ATTR(COLOR_PAIR(WHITE_ON_RED) | A_BOLD, A_REVERSE)
#define ATTR_WAITNORMAL_STR ATTR(COLOR_PAIR(CYAN_ON_BLUE), A_NORMAL)
#define ATTR_WAITERROR_STR ATTR(COLOR_PAIR(WHITE_ON_RED), A_REVERSE)
#define ATTR_MAP_EMPTY ATTR(COLOR_PAIR(BLUE_ON_BLACK) | A_BOLD, A_NORMAL)
#define ATTR_MAP_OUTPOST ATTR(COLOR_PAIR(GREEN_ON_BLACK) | A_BOLD, A_NORMAL)
#define ATTR_MAP_STAR ATTR(COLOR_PAIR(YELLOW_ON_BLACK) | A_BOLD, A_BOLD)
#define ATTR_MAP_COMPANY ATTR(COLOR_PAIR(RED_ON_BLACK) | A_BOLD, A_NORMAL)
#define ATTR_MAP_CHOICE ATTR(COLOR_PAIR(WHITE_ON_RED) | A_BOLD, A_REVERSE)
/************************************************************************