summaryrefslogtreecommitdiffstats
path: root/tetris
diff options
context:
space:
mode:
authornat <nat@NetBSD.org>2015-07-07 22:53:25 +0000
committernat <nat@NetBSD.org>2015-07-07 22:53:25 +0000
commita71393a423c7482e64d77207e75b5fe05c63a6c6 (patch)
tree7cde943892df6e000a512c686120329065ea34ce /tetris
parent7836f591ed7ba0e9fcad03353cbdf8c2742aad61 (diff)
downloadbsdgames-darwin-a71393a423c7482e64d77207e75b5fe05c63a6c6.tar.gz
bsdgames-darwin-a71393a423c7482e64d77207e75b5fe05c63a6c6.tar.zst
bsdgames-darwin-a71393a423c7482e64d77207e75b5fe05c63a6c6.zip
Fixes color scheme white on black and black on white.
This commit was approved by christos@
Diffstat (limited to 'tetris')
-rw-r--r--tetris/screen.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/tetris/screen.c b/tetris/screen.c
index 4d7911c6..1babdb49 100644
--- a/tetris/screen.c
+++ b/tetris/screen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: screen.c,v 1.29 2014/07/13 16:23:55 pgoyette Exp $ */
+/* $NetBSD: screen.c,v 1.30 2015/07/07 22:53:25 nat Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -98,12 +98,16 @@ static void
setcolor(int c)
{
char *buf;
+ char monochrome[] = "\033[0m";
if (nocolor == 1)
return;
if (set_a_foreground == NULL)
return;
- buf = tiparm(set_a_foreground, c == 7 ? 0 : c);
+ if (c == 0 || c == 7)
+ buf = monochrome;
+ else
+ buf = tiparm(set_a_foreground, c);
if (buf != NULL)
putpad(buf);
}
@@ -303,6 +307,7 @@ scr_update(void)
putpad(cursor_home);
else
moveto(0, 0);
+ setcolor(0);
(void) printf("Score: %d", score);
curscore = score;
}
@@ -359,12 +364,12 @@ scr_update(void)
}
if (enter_standout_mode) {
if (so != cur_so) {
+ setcolor(so);
putpad(so ?
enter_standout_mode :
exit_standout_mode);
cur_so = so;
}
- setcolor(so);
#ifdef DEBUG
char buf[3];
snprintf(buf, sizeof(buf), "%d%d", so, so);