diff options
Diffstat (limited to 'tetris')
-rw-r--r-- | tetris/screen.c | 5 | ||||
-rw-r--r-- | tetris/tetris.c | 3 | ||||
-rw-r--r-- | tetris/tetris.h | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/tetris/screen.c b/tetris/screen.c index 62d50a2d..193b2c6a 100644 --- a/tetris/screen.c +++ b/tetris/screen.c @@ -1,4 +1,4 @@ -/* $NetBSD: screen.c,v 1.31 2015/11/06 19:53:37 christos Exp $ */ +/* $NetBSD: screen.c,v 1.32 2016/03/03 21:38:55 nat Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -197,6 +197,7 @@ scr_set(void) MINCOLS, MINROWS); stop(""); /* stop() supplies \n */ } + Offset = (Rows - D_LAST + D_FIRST - 2) / 2; if (tcgetattr(0, &oldtt) < 0) stop("tcgetattr() fails"); newtt = oldtt; @@ -360,7 +361,7 @@ scr_update(void) putpad(exit_standout_mode); cur_so = 0; } - moveto(RTOD(j), CTOD(i)); + moveto(RTOD(j + Offset), CTOD(i)); } if (enter_standout_mode) { if (so != cur_so) { diff --git a/tetris/tetris.c b/tetris/tetris.c index 1f5f68b4..5a41c158 100644 --- a/tetris/tetris.c +++ b/tetris/tetris.c @@ -1,4 +1,4 @@ -/* $NetBSD: tetris.c,v 1.31 2015/11/06 19:53:37 christos Exp $ */ +/* $NetBSD: tetris.c,v 1.32 2016/03/03 21:38:55 nat Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -62,6 +62,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\ cell board[B_SIZE]; /* 1 => occupied, 0 => empty */ int Rows, Cols; /* current screen size */ +int Offset; /* used to center board & shapes */ static const struct shape *curshape; const struct shape *nextshape; diff --git a/tetris/tetris.h b/tetris/tetris.h index 559ef761..7d18a2d1 100644 --- a/tetris/tetris.h +++ b/tetris/tetris.h @@ -1,4 +1,4 @@ -/* $NetBSD: tetris.h,v 1.14 2014/07/13 16:23:55 pgoyette Exp $ */ +/* $NetBSD: tetris.h,v 1.15 2016/03/03 21:38:55 nat Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -73,6 +73,7 @@ extern cell board[B_SIZE]; /* 1 => occupied, 0 => empty */ #define MINCOLS 40 extern int Rows, Cols; /* current screen size */ +extern int Offset; /* vert. offset to center board */ /* * Translations from board coordinates to display coordinates. |