blob: 75e42046c6b64c10147372b73f08c13dc74fed22 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
import curses
key_left = ['h', 'a']
key_right = ['l', 'd']
key_down = ['j', 's']
key_up = ['k', 'w']
maxX = 4
maxY = 4
gamestate = [[0 for mx in range(maxX)] for my in range(maxY)]
gamestate[2][2] = 1
gamestate[1][2] = 1
gamestate[3][2] = 1
def DrawSquare(x, y, val):
stdscr.addstr(y, x, "+")
def FullDraw():
for i in range(maxY):
for j in range(maxX):
if gamestate[i][j] == 0:
continue
DrawSquare(j * 5, i * 3, gamestate[i][j])
def MoveLeft():
pass
def MoveRight():
pass
def MoveDown():
pass
def MoveUp():
pass
# Init
stdscr = curses.initscr()
stdscr.noecho()
while True:
FullDraw()
userin = stdscr.getch()
if userin == 'q':
break
if userin in key_left:
MoveLeft()
elif userin in key_right:
MoveRight()
elif userin in key_down:
MoveDown()
elif userin in key_up:
MoveUp()
curses.endwin()
|