Skip to content

Commit 582d57b

Browse files
committed
fix backgrounds and remove CP6 compatibility
1 parent 7de9f43 commit 582d57b

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

adafruit_pyoa.py

+6-16
Original file line numberDiff line numberDiff line change
@@ -401,22 +401,12 @@ def set_background(self, filename, *, with_fade=True):
401401
self._background_group.pop()
402402

403403
if filename:
404-
if self._background_file:
405-
self._background_file.close()
406-
with open(
407-
self._gamedirectory + "/" + filename, "rb"
408-
) as self._background_file:
409-
# TODO: Once CP6 is no longer supported, pass combined filename into OnDiskBitmap
410-
background = displayio.OnDiskBitmap(self._background_file)
411-
self._background_sprite = displayio.TileGrid(
412-
background,
413-
pixel_shader=getattr(
414-
background, "pixel_shader", displayio.ColorConverter()
415-
),
416-
# TODO: Once CP6 is no longer supported, replace the above line with below
417-
# pixel_shader=background.pixel_shader,
418-
)
419-
self._background_group.append(self._background_sprite)
404+
background = displayio.OnDiskBitmap(self._gamedirectory + "/" + filename)
405+
self._background_sprite = displayio.TileGrid(
406+
background,
407+
pixel_shader=background.pixel_shader,
408+
)
409+
self._background_group.append(self._background_sprite)
420410
if with_fade:
421411
self._display.refresh(target_frames_per_second=60)
422412
self.backlight_fade(1.0)

0 commit comments

Comments
 (0)