kopia lustrzana https://github.com/villares/sketch-a-day
Update sketch_2021_03_27a.pyde
rodzic
e1f8a40a0b
commit
43d0c86590
|
@ -29,9 +29,7 @@ def draw():
|
||||||
|
|
||||||
def draw_tabuleiro(tabuleiro, visivel):
|
def draw_tabuleiro(tabuleiro, visivel):
|
||||||
for i in range(tam_tabuleiro):
|
for i in range(tam_tabuleiro):
|
||||||
label(i)
|
|
||||||
for j in range(tam_tabuleiro):
|
for j in range(tam_tabuleiro):
|
||||||
label(j, vertical=True)
|
|
||||||
if (i, j) in visivel:
|
if (i, j) in visivel:
|
||||||
if (i, j) in tabuleiro:
|
if (i, j) in tabuleiro:
|
||||||
fill(0)
|
fill(0)
|
||||||
|
@ -42,7 +40,13 @@ def draw_tabuleiro(tabuleiro, visivel):
|
||||||
square(i * tam_casa + borda,
|
square(i * tam_casa + borda,
|
||||||
j * tam_casa + borda,
|
j * tam_casa + borda,
|
||||||
tam_casa)
|
tam_casa)
|
||||||
|
|
||||||
|
for n in range(tam_tabuleiro):
|
||||||
|
fill(0)
|
||||||
|
pos = n * tam_casa + borda + meia_casa
|
||||||
|
text(n, meia_casa, pos)
|
||||||
|
text(n, pos, height - meia_casa * 1.2)
|
||||||
|
|
||||||
def mouseClicked():
|
def mouseClicked():
|
||||||
mnta = mouse_no_tabuleiro(mouseX, mouseY)
|
mnta = mouse_no_tabuleiro(mouseX, mouseY)
|
||||||
modifica_tabuleiro(mnta, visivel_a)
|
modifica_tabuleiro(mnta, visivel_a)
|
||||||
|
@ -62,11 +66,3 @@ def mouse_no_tabuleiro(x, y):
|
||||||
return (i, j)
|
return (i, j)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def label(n, vertical=False):
|
|
||||||
fill(0)
|
|
||||||
pos = n * tam_casa + borda + meia_casa
|
|
||||||
if vertical:
|
|
||||||
text(n, meia_casa, pos)
|
|
||||||
else:
|
|
||||||
text(n, pos, height - meia_casa * 1.2)
|
|
||||||
|
|
Ładowanie…
Reference in New Issue