Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/tetris Fixes color scheme white on black and black on ...



details:   https://anonhg.NetBSD.org/src/rev/f92a252f3709
branches:  trunk
changeset: 339243:f92a252f3709
user:      nat <nat%NetBSD.org@localhost>
date:      Tue Jul 07 22:53:25 2015 +0000

description:
Fixes color scheme white on black and black on white.

This commit was approved by christos@

diffstat:

 games/tetris/screen.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (49 lines):

diff -r a25aad4ed232 -r f92a252f3709 games/tetris/screen.c
--- a/games/tetris/screen.c     Tue Jul 07 21:43:46 2015 +0000
+++ b/games/tetris/screen.c     Tue Jul 07 22:53:25 2015 +0000
@@ -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 @@
 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 @@
                        putpad(cursor_home);
                else
                        moveto(0, 0);
+               setcolor(0);
                (void) printf("Score: %d", score);
                curscore = score;
        }
@@ -359,12 +364,12 @@
                        }
                        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);



Home | Main Index | Thread Index | Old Index