|
86 | 86 | pyportal.play_file("/vo/pathfnd_silent.wav") # hack to deal w no mute method |
87 | 87 |
|
88 | 88 | while True: |
89 | | - if pyportal.touchscreen.touch_point: |
90 | | - i = (i + 1) % 11 |
91 | | - pixel.fill(colors[i]) |
92 | | - pixel.show() |
93 | | - time.sleep(1) |
94 | | - with open(emote_img[i], "rb") as bitmap_file: |
95 | | - bitmap = displayio.OnDiskBitmap(bitmap_file) |
96 | | - tile_grid = displayio.TileGrid( |
97 | | - bitmap, pixel_shader=getattr(bitmap, 'pixel_shader', displayio.ColorConverter()) |
98 | | - ) |
99 | | - group = displayio.Group() |
100 | | - group.append(tile_grid) |
101 | | - display.show(group) |
102 | | - if sound_mode is not 0: |
103 | | - # play a sound file |
104 | | - pyportal.play_file(vo_sound[i]) |
105 | | - else: |
106 | | - pyportal.play_file("/vo/pathfnd_silent.wav") |
| 89 | + if not pyportal.touchscreen.touch_point: |
| 90 | + time.sleep(0.01) |
| 91 | + continue |
| 92 | + |
| 93 | + i = (i + 1) % 11 |
| 94 | + pixel.fill(colors[i]) |
| 95 | + pixel.show() |
| 96 | + time.sleep(1) |
| 97 | + |
| 98 | + # CircuitPython 6 & 7 compatible |
| 99 | + with open(emote_img[i], "rb") as bitmap_file: |
| 100 | + bitmap = displayio.OnDiskBitmap(bitmap_file) |
| 101 | + tile_grid = displayio.TileGrid( |
| 102 | + bitmap, |
| 103 | + pixel_shader=getattr(bitmap, 'pixel_shader', displayio.ColorConverter()) |
| 104 | + ) |
| 105 | + group = displayio.Group() |
| 106 | + group.append(tile_grid) |
| 107 | + display.show(group) |
| 108 | + |
| 109 | + # # CircuitPython 7+ compatible |
| 110 | + # bitmap = displayio.OnDiskBitmap(emote_img[i]) |
| 111 | + # tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader) |
| 112 | + # group = displayio.Group() |
| 113 | + # group.append(tile_grid) |
| 114 | + # display.show(group) |
| 115 | + |
| 116 | + if sound_mode is not 0: |
| 117 | + # play a sound file |
| 118 | + pyportal.play_file(vo_sound[i]) |
| 119 | + else: |
| 120 | + pyportal.play_file("/vo/pathfnd_silent.wav") |
0 commit comments