Exemple #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);
}
Exemple #2
0
int selectitem(const char **items, int n, int *i, int k)
{
	int x, y;
	switch (k) {
	case 0:
		break;
	case MVLEFT:
		if (*i)
			*i -= 1;
		break;
	case MVRIGHT:
		if (*i < n-1)
			*i += 1;
		break;
	case STARTBTN:
	case A_BTN:
		get_xy(&x, &y);
		n = dropdownlist(items, n, *i, x, y);
		if (n)
			*i = n-1;
		setcurs(x, y);
		return 3;
	default:
		return 0;
	}
	putch('[');
	printstr(items[*i]);
	n = getdropdownwidth(items, n) - strlen(items[*i]);
	putnchars(' ', n);
	printstr("] ");
	return 1;
}
Exemple #3
0
static int op_handler(int k, int *pos)
{
	const struct termopt opt = {ASCII, "CP437 ASCII", "drawing"};
	int i = *pos-2;
	if (i < 0) {
		if (k) {
			clearbox(0, 16, 0, 4);
			inputsetup_box(k-1, 1, 7);
		}
		draw_options_box();
		return 1;
	}
	if (!i) {
		if (k == MVLEFT)
			i = 0;
		else if (k == MVRIGHT)
			i = 1;
		else {
			i = !getopt_int("", "fullscreen");
			if (k == A_BTN)
				i = !i;
			else if (k)
				return 0;
		}
		printmenuitem_options("yes no", i);
		if (k) {
			union val v;
			v.integ = !i;
			setoption("", "fullscreen", v, 0);
		}
		i = 1;
	} else if (i == 1) {
		if (!k) {
			get_xy(&k, &i);
			setcurs(2, i+5);
			putnchars(HLINE, 28);
			help_alt_enter();
			setcurs(k, i);
			k = 0;
		}
		i = term_optionhandler(k, &opt);
	}
#ifndef NO_BLOCKSTYLES
	else
		i = select_blockstyle(k);
#endif
	if (i == 3) {
		draw_tetris_logo(0, 0);
		draw_options_box();
	}
	return i;
}
Exemple #4
0
void inp_printkeys(int dev, int x, int y)
{
	const char *k;
	int i;
	x += 6;
	setcurs(x, y);
	for (i = 0; i < 11; i++) {
		k = getkeyfor_str(dev, inp_keypr(i));
		printstr(k);
		putnchars(' ', 6-strlen(k));
		if (i == 5) {
			x += 17;
			setcurs(x, y);
		} else
			newln(x);
	}
}
Exemple #5
0
static int op_handler(int k, int *pos)
{
	const struct termopt opts[2] = {
		{ WHITE_BG, "black white", "bg" },
		{ ASCII, "VT100 ASCII", "drawing" }
	};
	int i = *pos-2;
	if (i < 0) {
		if (k) {
			setcurs(0, 16);
			wclrtobot(window);
			inputsetup_box(k-1, 1, 7);
		}
		draw_options_box();
		return 1;
	}
	if (!i && !k) {
		getyx(window, i, k);
		setcurs(2, i+5+!(textgfx_flags & CYGWIN));
		putnchars(HLINE, 28);
		help_cmdline();
		setcurs(k, i);
		i = k = 0;
	}
	if (i < 1+!(textgfx_flags & CYGWIN))
		i = term_optionhandler(k, opts+i);
#ifndef NO_BLOCKSTYLES
	else
		i = select_blockstyle(k);
#endif
	if (i == 3) {
		draw_tetris_logo(0, 0);
		if (!_MONOCHROME) {
			init_color_pairs();
			if (*pos == 2)
				clearok(window, TRUE);
		}
		draw_options_box();
	}
	return i;
}
Exemple #6
0
static void hiscoreline()
{
	setcolorpair(RED_FG);
	putnchars('-', 9);
	setattr_normal();
}