|
28 | 28 |
|
29 | 29 | # --- Display setup --- |
30 | 30 | matrix = Matrix(bit_depth=4) |
31 | | -sprite_group = displayio.Group(max_size=1) |
| 31 | +sprite_group = displayio.Group() |
32 | 32 | matrix.display.show(sprite_group) |
33 | 33 |
|
34 | 34 | # --- Button setup --- |
@@ -68,23 +68,30 @@ def load_image(): |
68 | 68 | while sprite_group: |
69 | 69 | sprite_group.pop() |
70 | 70 |
|
71 | | - bitmap = displayio.OnDiskBitmap( |
72 | | - open(SPRITESHEET_FOLDER + "/" + file_list[CURRENT_IMAGE], "rb") |
73 | | - ) |
74 | | - |
75 | | - FRAME_COUNT = int(bitmap.height / matrix.display.height) |
76 | | - FRAME_DURATION = DEFAULT_FRAME_DURATION |
| 71 | + filename = SPRITESHEET_FOLDER + "/" + file_list[CURRENT_IMAGE] |
77 | 72 |
|
| 73 | + # CircuitPython 6 & 7 compatible |
| 74 | + bitmap = displayio.OnDiskBitmap(open(filename, "rb")) |
78 | 75 | sprite = displayio.TileGrid( |
79 | 76 | bitmap, |
80 | 77 | pixel_shader=getattr(bitmap, 'pixel_shader', displayio.ColorConverter()), |
81 | | - width=1, |
82 | | - height=1, |
83 | 78 | tile_width=bitmap.width, |
84 | 79 | tile_height=matrix.display.height, |
85 | 80 | ) |
86 | 81 |
|
| 82 | + # # CircuitPython 7+ compatible |
| 83 | + # bitmap = displayio.OnDiskBitmap(filename) |
| 84 | + # sprite = displayio.TileGrid( |
| 85 | + # bitmap, |
| 86 | + # pixel_shader=bitmap.pixel_shader, |
| 87 | + # tile_width=bitmap.width, |
| 88 | + # tile_height=matrix.display.height, |
| 89 | + # ) |
| 90 | + |
87 | 91 | sprite_group.append(sprite) |
| 92 | + |
| 93 | + FRAME_COUNT = int(bitmap.height / matrix.display.height) |
| 94 | + FRAME_DURATION = DEFAULT_FRAME_DURATION |
88 | 95 | CURRENT_FRAME = 0 |
89 | 96 | CURRENT_LOOP = 0 |
90 | 97 |
|
|
0 commit comments