Skip to content

Commit e6f5536

Browse files
committed
updated text function and letters demo
1 parent 156230c commit e6f5536

File tree

4 files changed

+25
-18
lines changed

4 files changed

+25
-18
lines changed

.vscode/settings.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"python.formatting.provider": "black"
3-
}
2+
"python.formatting.provider": "black",
3+
"editor.formatOnSave": true,
4+
"editor.codeActionsOnSave": {}
5+
}

demos/letters/main.py

+20-14
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,28 @@ def __init__(self, input_queue, output_queue, screen):
1818

1919
def run(self):
2020
# Create generator here
21-
width = 16
22-
height = 6
23-
sleep_time = 0.075
21+
# width = 16
22+
# height = 6
2423

25-
modules = [j for sub in self.screen.board_objects for j in sub]
24+
# modules = [j for sub in self.screen.board_objects for j in sub]
25+
# while True:
26+
# for mod in modules:
27+
# x1 = random.randint(0, width - 1)
28+
# y1 = random.randint(0, height - 1)
29+
# x2 = random.randint(0, width - 1)
30+
# y2 = random.randint(0, height - 1)
31+
# letter1 = chr(random.randint(33, 126))
32+
# # letter2 = chr(random.randint(33, 126))
33+
# mod.letter2(x1, y1, letter1)
34+
# mod.letter2(x2, y2, " ")
35+
# mod.flush()
36+
# yield
2637
while True:
27-
for mod in modules:
28-
x1 = random.randint(0, width - 1)
29-
y1 = random.randint(0, height - 1)
30-
x2 = random.randint(0, width - 1)
31-
y2 = random.randint(0, height - 1)
32-
letter1 = chr(random.randint(33, 126))
33-
# letter2 = chr(random.randint(33, 126))
34-
mod.letter2(x1, y1, letter1)
35-
mod.letter2(x2, y2, " ")
36-
mod.flush()
38+
for _ in range(4):
39+
self.screen.draw_text(random.randint(0,self.screen.x_width-1),random.randint(0,self.screen.y_height-2),chr(random.randint(33, 126)))
40+
for _ in range(4):
41+
self.screen.draw_text(random.randint(0,self.screen.x_width-1),random.randint(0,self.screen.y_height-2)," ")
42+
self.screen.push()
3743
yield
3844

3945
def stop(self):

display/game_display.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def draw_shape_line(
231231
self.push()
232232

233233
def draw_text(self, x, y, msg, combine=True, push=False):
234-
"""Print a message to the screen
234+
"""Print a message to the screen, y_height-2 is lowest y value accepted without error
235235
236236
x -- x coordinate
237237
y -- y coordinate

simulator/standalone_sim.py

-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ def _repopulate_demo_list(self):
100100
# create lists to display demos better
101101
for index, key in enumerate(self.demos.keys()):
102102
if index % 13 == 0:
103-
print("new page:",index)
104103
self.demo_lst.append([])
105104
self.demo_lst[-1].append(key)
106105
self.demo_list_index = 0

0 commit comments

Comments
 (0)