From 02c60ff9fc0555ec4b69409ff2d0be522ff67ee7 Mon Sep 17 00:00:00 2001 From: dholland Date: Mon, 29 Mar 2010 04:28:47 +0000 Subject: Some improvements to the new UI. --- gomoku/bdisp.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'gomoku/bdisp.c') diff --git a/gomoku/bdisp.c b/gomoku/bdisp.c index 075ea172..83db2d06 100644 --- a/gomoku/bdisp.c +++ b/gomoku/bdisp.c @@ -1,4 +1,4 @@ -/* $NetBSD: bdisp.c,v 1.14 2010/03/29 03:51:55 dholland Exp $ */ +/* $NetBSD: bdisp.c,v 1.15 2010/03/29 04:28:47 dholland Exp $ */ /* * Copyright (c) 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)bdisp.c 8.2 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: bdisp.c,v 1.14 2010/03/29 03:51:55 dholland Exp $"); +__RCSID("$NetBSD: bdisp.c,v 1.15 2010/03/29 04:28:47 dholland Exp $"); #endif #endif /* not lint */ @@ -260,6 +260,24 @@ ask(const char *str) refresh(); } +int +get_key(const char *allowed) +{ + int ch; + + while (1) { + ch = getch(); + if (allowed != NULL && + ch != '\0' && strchr(allowed, ch) == NULL) { + beep(); + refresh(); + continue; + } + break; + } + return ch; +} + int get_line(char *buf, int size) { @@ -321,7 +339,7 @@ get_coord(void) nx = curx; ny = cury; for (;;) { - mvprintw(BSZ3, (BSZ -6)/2, "(%c %d)", + mvprintw(BSZ3, (BSZ -6)/2, "(%c %d) ", 'A'+ ((curx > 7) ? (curx+1) : curx), cury + 1); BGOTO(cury, curx); @@ -431,9 +449,11 @@ get_coord(void) break; #endif /* 0 */ case 'Q': + case 'q': return RESIGN; break; case 'S': + case 's': return SAVE; break; case ' ': -- cgit v1.2.3