Skip to content

Commit 62d6a63

Browse files
committed
updated
1 parent af23244 commit 62d6a63

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

dumbdisplay/ddlayer_multilevel.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ def moveLevelAnchorBy(self, by_x: float, by_y: float, reach_in_millis: int = 0):
8787
else:
8888
self.dd._sendCommand(self.layer_id, DDC_movelevelanchorby, _DD_FLOAT_ARG(by_x), _DD_FLOAT_ARG(by_y))
8989
def setLevelRotation(self, angle: float, pivotX: float = 0, pivotY: float = 0):
90-
if pivotX == 0 and pivotY == 0:
90+
if angle == 0 and pivotX == 0 and pivotY == 0:
91+
self.dd._sendCommand(self.layer_id, DDC_setlevelrotate)
92+
elif pivotX == 0 and pivotY == 0:
9193
self.dd._sendCommand(self.layer_id, DDC_setlevelrotate, _DD_FLOAT_ARG(angle))
9294
elif pivotY == 0:
9395
self.dd._sendCommand(self.layer_id, DDC_setlevelrotate, _DD_FLOAT_ARG(angle), _DD_FLOAT_ARG(pivotX))

dumbdisplay_examples/tetris/tetris_common.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ def __init__(self, x: int, y: int, block_grid: Grid, block_pen: LayerTurtle):
4949
self.block_grid = block_grid
5050
self.block_pen = block_pen
5151
block_pen.clear()
52+
if True:
53+
# make the block tiled a bit
54+
block_pen.setLevelRotation(2, 90, 120) # calculated from _left and _top
5255
self.sync_image()
5356
_draw_grid(block_grid, block_pen)
5457

@@ -75,7 +78,6 @@ def move_left(self, grid: Grid) -> bool:
7578
return True
7679

7780
def sync_image(self):
78-
#anchor_x = (self.x - _INIT_BLOCK_X) * _block_unit_width
7981
anchor_x = self.x * _block_unit_width
8082
anchor_y = self.y * _block_unit_width
8183
self.block_pen.setLevelAnchor(anchor_x, anchor_y)

dumbdisplay_examples/tetris/tetris_two_block.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ def _randomize_block_grid() -> Grid:
2626
if True:
2727
n_rows = random.randint(1, 2)
2828
n_cols = random.randint(1, 2)
29+
if False: # TODO: disable after debug
30+
n_rows = 1
31+
n_cols = 2
2932
block_grid = []
3033
for y in range(n_rows):
3134
block_grid_row = []

0 commit comments

Comments
 (0)