]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - tetris/screen.c
Add a little color. In order to minimize logic differences, keep 0 as the
[bsdgames-darwin.git] / tetris / screen.c
index ed9e849b5ab39729d783dbba5d8ac0d2dd82d5a7..50a019d3e3c3f978de481ba880b4daa20d5683d3 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: screen.c,v 1.26 2010/02/03 15:34:39 roy Exp $  */
+/*     $NetBSD: screen.c,v 1.28 2014/06/11 16:47:39 christos Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -89,7 +89,19 @@ moveto(int r, int c)
 {
        char *buf;
 
-       buf = vtparm(cursor_address, r, c);
+       buf = tiparm(cursor_address, r, c);
+       if (buf != NULL)
+               putpad(buf);
+}
+
+static void
+setcolor(int c)
+{
+       char *buf;
+       if (set_a_foreground == NULL)
+               return;
+
+       buf = tiparm(set_a_foreground, c == 7 ? 0 : c);
        if (buf != NULL)
                putpad(buf);
 }
@@ -312,6 +324,7 @@ scr_update(void)
                                                
                /* draw */
                putpad(enter_standout_mode);
+               setcolor(nextshape->color);
                moveto(r, 2*c);
                putstr("  ");
                for(i=0; i<3; i++) {
@@ -349,7 +362,14 @@ scr_update(void)
                                            exit_standout_mode);
                                        cur_so = so;
                                }
+                               setcolor(so);
+#ifdef DEBUG
+                               char buf[3];
+                               snprintf(buf, sizeof(buf), "%d%d", so, so);
+                               putstr(buf);
+#else
                                putstr("  ");
+#endif
                        } else
                                putstr(so ? "XX" : "  ");
                        ccol = i + 1;