Remove usage of max_size from displayio.Group
This commit is contained in:
parent
a68a5c2108
commit
62f2f2d9a0
3 changed files with 9 additions and 11 deletions
|
|
@ -53,7 +53,7 @@ class Wheel(displayio.TileGrid):
|
|||
if time.monotonic_ns() > self.stop_time:
|
||||
self.state = BRAKING
|
||||
elif self.state == BRAKING:
|
||||
# More quickly lose speed when baking, down to speed 7
|
||||
# More quickly lose speed when braking, down to speed 7
|
||||
self.vel = max(self.vel * 85 // 100, 7)
|
||||
|
||||
# Advance the wheel according to the velocity, and wrap it around
|
||||
|
|
@ -72,7 +72,6 @@ class Wheel(displayio.TileGrid):
|
|||
if self.state == BRAKING and self.vel == 7 and yyy < 4:
|
||||
self.pos = off * 24 * 16
|
||||
self.vel = 0
|
||||
yy = 0
|
||||
self.state = STOPPED
|
||||
|
||||
# Move the displayed tiles to the correct height and make sure the
|
||||
|
|
@ -87,11 +86,11 @@ class Wheel(displayio.TileGrid):
|
|||
def kick(self, i):
|
||||
self.state = RUNNING
|
||||
self.vel = random.randint(256, 320)
|
||||
self.stop_time = time.monotonic_ns() + 3000000000 + i * 350000000
|
||||
self.stop_time = time.monotonic_ns() + 3_000_000_000 + i * 350_000_000
|
||||
|
||||
# Our fruit machine has 3 wheels, let's create them with a correct horizontal
|
||||
# (x) offset and arbitrary vertical (y) offset.
|
||||
g = displayio.Group(max_size=3)
|
||||
g = displayio.Group()
|
||||
wheels = []
|
||||
for idx in range(3):
|
||||
wheel = Wheel()
|
||||
|
|
@ -119,7 +118,7 @@ for idx, si in enumerate(wheels):
|
|||
|
||||
# Here's the main loop
|
||||
while True:
|
||||
# Refresh the dislpay (doing this manually ensures the wheels move
|
||||
# Refresh the display (doing this manually ensures the wheels move
|
||||
# together, not at different times)
|
||||
display.refresh(minimum_frames_per_second=0)
|
||||
if all_stopped():
|
||||
|
|
|
|||
|
|
@ -85,10 +85,10 @@ b2 = displayio.Bitmap(display.width//SCALE, display.height//SCALE, 2)
|
|||
palette = displayio.Palette(2)
|
||||
tg1 = displayio.TileGrid(b1, pixel_shader=palette)
|
||||
tg2 = displayio.TileGrid(b2, pixel_shader=palette)
|
||||
g1 = displayio.Group(max_size=3, scale=SCALE)
|
||||
g1 = displayio.Group(scale=SCALE)
|
||||
g1.append(tg1)
|
||||
display.show(g1)
|
||||
g2 = displayio.Group(max_size=3, scale=SCALE)
|
||||
g2 = displayio.Group(scale=SCALE)
|
||||
g2.append(tg2)
|
||||
|
||||
# First time, show the Conway tribute
|
||||
|
|
|
|||
|
|
@ -30,14 +30,14 @@ def tilegrid(palette):
|
|||
bitmap=terminalio.FONT.bitmap, pixel_shader=palette,
|
||||
width=1, height=1, tile_width=6, tile_height=14, default_tile=32)
|
||||
|
||||
g = displayio.Group(max_size=2)
|
||||
g = displayio.Group()
|
||||
|
||||
# We only use the built in font which we treat as being 7x14 pixels
|
||||
linelen = (64//7)+2
|
||||
|
||||
# prepare the main groups
|
||||
l1 = displayio.Group(max_size=linelen)
|
||||
l2 = displayio.Group(max_size=linelen)
|
||||
l1 = displayio.Group()
|
||||
l2 = displayio.Group()
|
||||
g.append(l1)
|
||||
g.append(l2)
|
||||
display.show(g)
|
||||
|
|
@ -101,7 +101,6 @@ def scroll(t, b):
|
|||
l1.x = -j
|
||||
l2.x = -j
|
||||
display.refresh(minimum_frames_per_second=0)
|
||||
#display.refresh(minimum_frames_per_second=0)
|
||||
|
||||
# Repeatedly scroll all the pairs of lines
|
||||
while True:
|
||||
|
|
|
|||
Loading…
Reference in a new issue