summaryrefslogtreecommitdiff
path: root/tui
diff options
context:
space:
mode:
authorAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-01-11 23:30:10 +0200
committerAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-01-11 23:30:10 +0200
commit4ec901620ea94e8e89710576b4fc6ad1cf4b01e8 (patch)
tree434e89cc84bfa6aa2ac71978186d7a0c40ce8a0c /tui
parentf523205db34d86292bcb9db386c3f956f557b904 (diff)
Making UI roll upp and down so that playing area stays.
Diffstat (limited to 'tui')
-rw-r--r--tui/tui.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tui/tui.py b/tui/tui.py
index 1cacf30..1672d7d 100644
--- a/tui/tui.py
+++ b/tui/tui.py
@@ -31,6 +31,9 @@ class Tui():
if color>=0 and color<8:
print(end=f"\033[4{color}m")
+ def cursor_up(self, lines):
+ print(end=f"\033[{lines}F")
+
def reset_color(self):
print(end="\033[0m")
@@ -53,6 +56,7 @@ class Tui():
self.reset_color()
def draw_matrix(self, matrix, hx, hy ):
+ self.cursor_up(len(matrix[0]))
for y in range(len(matrix[0])):
for x in range(len(matrix)):
self.draw_tile( matrix[x][y],
@@ -88,7 +92,6 @@ class Tui():
x = len(matrix)-1 if x >= len(matrix) else x
y = len(matrix[0])-1 if y >= len(matrix[0]) else y
- print(repr(c))
self.draw_matrix(matrix, x, y)
\ No newline at end of file