mirror of
https://git.zap.org.au/git/trader.git
synced 2024-11-03 17:27:29 -05:00
Replace individual colour/window attributes with ATTR_ macros
This commit is contained in:
parent
dd281f795b
commit
42e05ee20b
11
src/intf.c
11
src/intf.c
@ -52,6 +52,7 @@ typedef struct txwin {
|
||||
************************************************************************/
|
||||
|
||||
WINDOW *curwin = NULL; // Top-most (current) window
|
||||
bool use_color = false; // True to use colour in Star Traders
|
||||
|
||||
|
||||
/************************************************************************
|
||||
@ -84,6 +85,8 @@ void init_screen (void)
|
||||
MIN_COLS, MIN_LINES);
|
||||
}
|
||||
|
||||
use_color = has_colors();
|
||||
|
||||
curwin = stdscr;
|
||||
topwin = NULL;
|
||||
firstwin = NULL;
|
||||
@ -92,7 +95,7 @@ void init_screen (void)
|
||||
curs_set(CURS_OFF);
|
||||
raw();
|
||||
|
||||
if (has_colors()) {
|
||||
if (use_color) {
|
||||
start_color();
|
||||
|
||||
init_pair(WHITE_ON_BLACK, COLOR_WHITE, COLOR_BLACK);
|
||||
@ -103,14 +106,14 @@ void init_screen (void)
|
||||
init_pair(YELLOW_ON_CYAN, COLOR_YELLOW, COLOR_CYAN);
|
||||
init_pair(BLACK_ON_WHITE, COLOR_BLACK, COLOR_WHITE);
|
||||
|
||||
bkgd(COLOR_PAIR(WHITE_ON_BLACK));
|
||||
bkgd(ATTR_ROOT_WINDOW);
|
||||
}
|
||||
|
||||
clear();
|
||||
|
||||
attrset(ATTR(COLOR_PAIR(YELLOW_ON_CYAN) | A_BOLD, A_REVERSE | A_BOLD));
|
||||
attrset(ATTR_GAME_TITLE);
|
||||
center(stdscr, 0, true, PACKAGE_NAME);
|
||||
attrset(A_NORMAL);
|
||||
attrset(ATTR_ROOT_WINDOW);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
13
src/intf.h
13
src/intf.h
@ -98,7 +98,7 @@ typedef enum curs_type {
|
||||
|
||||
|
||||
// Colour and non-colour attribute selection
|
||||
#define ATTR(color, nocolor) (has_colors() ? (color) : (nocolor))
|
||||
#define ATTR(color, nocolor) (use_color ? (color) : (nocolor))
|
||||
|
||||
|
||||
// Colour pairs used in Star Traders
|
||||
@ -114,11 +114,22 @@ enum color_pairs {
|
||||
};
|
||||
|
||||
|
||||
// Window attributes used in Star Traders
|
||||
#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_STATUS_WINDOW ATTR(COLOR_PAIR(BLACK_ON_WHITE), A_REVERSE)
|
||||
#define ATTR_WINDOW_TITLE ATTR(COLOR_PAIR(YELLOW_ON_BLACK) | A_BOLD, A_REVERSE)
|
||||
#define ATTR_KEYCODE_STR ATTR(COLOR_PAIR(YELLOW_ON_BLACK) | A_BOLD, A_REVERSE)
|
||||
#define ATTR_INPUT_FIELD ATTR(COLOR_PAIR(WHITE_ON_BLACK), A_BOLD | '_')
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Global variable declarations *
|
||||
************************************************************************/
|
||||
|
||||
extern WINDOW *curwin; // Top-most (current) window
|
||||
extern bool use_color; // True to use colour in Star Traders
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user