示例#1
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
}
示例#2
0
static int hiscore_congrats(const char **menu)
{
	char name[8] = "       ";
	int x = 9;
	int y = _HEIGHT_24L ? 7 : 3;
	setwcurs(0, 9, y);
	while (is_outside_screen(x+26, 0))
		x--;
	drawbox(x, y, 26, 9, "CONGRATULATIONS!");
	setcurs(x+2, y+2);
	printstr("You have a highscore!");  newln(x+2);
	printstr("Please enter your name");
entername:
	switch (hiscore_entername_menu(name, menu, x+4, y+4)) {
	case 0:
		return 0;
	case 1:
		if (savehiscore(name)) {
			if (x > 7)
				clearbox(33, y, 2, 9);
			return hiscorebox(menu, 9, y);
		}
		setcurs(x+2, y+2);
		printstr("ERROR! Could not save");  newln(x+2);
		printstr("score to file.        ");
		goto entername;
	case 2:
		clearbox(32, y, 0, 9);
		return 1;
	}
}
示例#3
0
文件: men_curses.c 项目: gsrr/Python
int startupmenu(int i)
{
	while (1) {
		drawbox(5, STARTUP_Y-2, 22, STARTUP_N+4, NULL);
		printmenuhelp(19);
		i = startup_menu(i-1, 8, STARTUP_Y);
# ifndef TTY_SOCKET
		if (!i)
			break;
# else
		if (i==2 && !select_2p_tty(24, STARTUP_Y+1))
			continue;
		if (!i) {
			setcurs(5, STARTUP_Y-2);
			wclrtobot(window);
			if ((i = menu_checkinvit(1, 7)) == -1) {
				refresh();
				setwcurs(0, 5, 7);
				i = 1;
				continue;
			}
			if (!i)
				break;
		}
		move(term_height-1, 0);
		clrtoeol();
		refresh();
# endif
		setcurs(5, STARTUP_Y-2);
		wclrtobot(window);
		break;
	}
	return i;
}
示例#4
0
int gameovermenu()
{
	const char *menu[2] = {"Play again", "Exit"};
	return hiscore_congrats(menu); //WILLIAMICED

	readhiscores(NULL);
	if (ishiscore())
		return hiscore_congrats(menu);
	setwcurs(1, 2, 3);
	drawbox(2, 3, 17, 5, "GAME OVER");
	return playagain_menu(menu, 4, 5);
}
示例#5
0
static void drawpanel_1p()
{
	int h24 = _HEIGHT_24L;
	int clr = (player1.level % 6)+1;
	int i;
	setwcurs(WIN_PANEL, 0, 0);
	setblockcolor(clr);
	printstr_acs("lqNu", 8);
	for (i = 0; i <= 8; i += 4)
		drawstr("\\xhNx\\3tqNu", 8, 0, i);
	if (h24) {
		setcurs(0, 12);
		putch(LOWLEFT);
		drawpanel_labels("Score", 1);
	} else {
		setcurs(0, 13);
		printstr_acs("xhNx", 8);
		drawpanel_labels("Score", 1);
		setcurs(2, 13);
		printstr(" Next ");
	}
	printstat_1p();
	drawpanel_bordercolor(clr);
	if (h24)
		drawstr("\\x\\6x", 6, 9, 12);
	else {
		drawstr("\\x Nx\\3mqNu", 8, 0, 13);
		drawstr("\\x\\x", 0, 9, 17);
	}
	i = 0;
	if (h24)
		i = 4;
	setwcurs(0, 0, i);
	drawpanel_bordercolor(clr);
	draw_vline(board_x(1, 10)+1, i, 20);
}
示例#6
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);
}
示例#7
0
void refreshwin(int win)
{
	static int redraw;
	struct player *p;
	if (redraw)
		return;
#ifdef TWOPLAYER
	if ((win == 1 || win == 2) && !game_running) {
		p = &game->player[win-1];
#else
	if (win == 1 && !game_running) {
		p = &player1;
#endif
		redraw = 1;
		if (game_paused)
			redrawboard(p, 19);
		else
			redrawboard(p, 3);
		redraw = 0;
	}
	refreshscreen();
}

/* only used for clearing window showing next tetromino and game screen */
void clearwin(int win)
{
	int h;
	setwcurs(win, 0, 0);
	if (win >= WIN_NEXT)
		clearbox(0, 0, 8, 2);
	else {
		margin_x = 0;
		h = term_height;
		if (h < 24 && h > 21)
			h = 21;
		clearbox(0, 0, 0, h);
	}
}
示例#8
0
static void print_tetr_stats()
{
	const char letters[8] = "IJLOSTZ";
	int sum = 0;
	int i;
	if (term_width < 45)
		return;
	setwcurs(WIN_TETROM_STATS, 1, 0);
	for (i = 0; i < 7; i++) {
		setblockcolor(tetrom_colors[i]);
		putch(block_chars[0]);
		putch(letters[i]);
		putch(block_chars[1]);
		setattr_normal();
		printint(" %03d", tetr_stats[i]);
		newln(1);
		sum += tetr_stats[i];
	}
	printstr("  -----");
	newln(0);
	printint("Sum %04d", sum);
	refreshwin(WIN_TETROM_STATS);
}
示例#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);
}
示例#10
0
void clearwinsave(int win)
{
	int h;
	setwcurs(win, 0, 0);
	clearbox(-20, 18, 12, 2);
}