Esempio n. 1
0
void printmenuitem(const char *name, int sel)
{
#if !NO_MENU
	if (*name == '-') {
		putch(' ');
		if (!name[1])
			putnchars('-', 16);
		else
			printstr(name);
		return;
	}
#endif
	if (!sel)
		setcolorpair(MAGENTA_FG);
	else if (!_MONOCHROME)
		setcolorpair(WHITE_ON_BLUE);
	else
		setattr_standout();
	if (sel && (textgfx_flags & TT_MONO)==TT_BLOCKS) {
		while (*name==' ') {
			putch(' ');
			name++;
		}
		putch('*');
	} else
		putch(' ');
	printstr(name);
	putch(' ');
	setattr_normal();
	movefwd(1);
}
Esempio n. 2
0
void drawboard(int pl)
{
	int x = board_x(pl, 0);
	int i;
	char tmp[30];
	if (_HEIGHT_24L) {
		//i = x+5;
		//setwcurs(0, i, 0);
		if (!_MONOCHROME) {
			setcolorpair(BOARD_FRAME_COLOR);
			setattr_bold();
		}
		//i = x-5;
		//setwcurs(0, i, 0);
		//sprintf(tmp, "lqNk\\x Nx\\| N|");
		//drawstr(tmp, 8, i, 0);

		i = x+5;
		setwcurs(0, i, 0);
		drawstr("lqNk\\x Nx\\2|_N|", 8, i, 0);

		setcolorpair(BOARD_FRAME_COLOR);
		setcurs(x, 3);
		printstr("_____");
		movefwd(10);
		printstr("_____");
		i = 4;
	} else
		i = 0;
	x--;
	setwcurs(0, x, i);
	setcolorpair(BOARD_FRAME_COLOR);
	for (i = 0; i < 20; i++) {
		putch(VLINE);
		movefwd(20);
		putch(VLINE);
		if (i < 19)
			newln(x);
	}
	if (term_height > 20 && term_height != 24) {
		newln(x);
		printstr_acs("m*Nj", 20);
	} else {
		setcurs(0, term_height-2);
		newln(0);
	}
#ifdef TWOPLAYER
	board_bottom_color[pl-1] = BOARD_FRAME_COLOR;
#endif
}
Esempio n. 3
0
void drawpanel_bordercolor(int clr)
{
	if (_MONOCHROME)
		setattr_normal();
	else
		setcolorpair(clr | 16);
}
Esempio n. 4
0
void printtextbox(const char *text, int pos)
{
	int underscore;
	if (_WHITE_BG)
		underscore = textgfx_flags & (ASCII | GNOME_TERM) || !_XTERM;
	else
		underscore = textgfx_flags & (MONOCHROME | TT_BLOCKS);
	while (*text) {
		setattr_normal();
		if (!pos)
			setattr_standout();
		else {
			if (_WHITE_BG) {
				if (!underscore || textgfx_flags & GNOME_TERM)
					setattr_underline();
			} else
				setcolorpair(WHITE_ON_BLUE);
		}
		if (*text == ' ' && underscore)
			putch('_');
		else
			putch(*text);
		text++;
		pos--;
	}
	setattr_normal();
}
Esempio n. 5
0
static void printsavebutton(int sel)
{
	if (_MONOCHROME) {
		if (sel)
			setattr_standout();
		else
			setattr_bold();
	} else if (sel) {
		setcolorpair(YELLOW_ON_GREEN);
	} else {
		setcolorpair(4);
		putch('[');
		setcolorpair(YELLOW_ON_BLUE);
		printstr(" Save ");
		setcolorpair(4);
		putch(']');
		goto out;
	}
	printstr("[ Save ]");
out:	setattr_normal();
}
Esempio n. 6
0
void drawpanel_labels(const char *first, int x)
{
	const char *s = first;
	int i;
	setcolorpair(PANEL_LABEL_COLOR);
	for (i = 1; i <= 9; i += 4) {
		setcurs(x, i);
		putch(' ');
		printstr(s);
		putch(' ');
		s = s==first ? "Level" : "Lines";
	}
}
Esempio n. 7
0
void print_game_message(int pl, const char *str, int bold)
{
	int x = board_x(pl, 4);
	int n = strlen(str);
	if (!(game->player[pl-1].rotationsys & ROT_LEFTHAND))
		x--;
	while (n >= 6) {
		x--;
		n -= 2;
	}
	setwcurs(0, x, _HEIGHT_24L ? 7 : 3);
	setattr_normal();
	if (bold)
		setcolorpair(MAGENTA_FG);
	printstr(str);
	refreshwin(0);
}
Esempio n. 8
0
static int op_tcolor(int k, int *pos)
{
	char *c = tetrom_colors + *pos;
	if (k >= '1' && k <= '7')
		*c = k-'0';
	else if (k == A_BTN) {
		*c += 1;
		if (*c == 8)
			*c = 1;
	} else if (k)
		return 0;
	setcolorpair(*c);
	putch(' ');
	putch(*c+'0');
	putch(' ');
	setattr_normal();
	return 1;
}
Esempio n. 9
0
static void print_top_scores()
{
	char s[8];
	const struct hiscore *hs = hiscores;
	int pos = 0;
	int i = 1;
	if (term_width < 47 || !hs[0].score)
		return;
	setwcurs(WIN_TOP_SCORES, 0, 0);
	setcolorpair(MAGENTA_FG);
	printstr("Top Scores");
	setattr_normal();
	while (hs->score && i <= 5) {
		newln(0);
		if (!pos && player1.score > hs->score) {
			hiscoreline();
			pos = 1;
			continue;
		}
		putch(i+'0');
		putch('.');
		if (hs->score < 1000000)
			putch(' ');
		sprintf(s, "%06ld", (long) hs->score);
		printstr(s);
		hs++;
		i++;
	}
	if (!pos) {
		newln(0);
		if (ishiscore())
			hiscoreline();
		else
			cleartoeol();
	}
	refreshwin(WIN_TOP_SCORES);
}
Esempio n. 10
0
static void hiscoreline()
{
	setcolorpair(RED_FG);
	putnchars('-', 9);
	setattr_normal();
}