Skip to content

Commit fb786ea

Browse files
authored
Merge pull request #29 from FoamyGuy/background_fix
fix backgrounds and remove CP6 compatibility
2 parents 9630ae4 + 582d57b commit fb786ea

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
@@ -414,22 +414,12 @@ def set_background(self, filename, *, with_fade=True):
414414
self._background_group.pop()
415415

416416
if filename:
417-
if self._background_file:
418-
self._background_file.close()
419-
with open(
420-
self._gamedirectory + "/" + filename, "rb"
421-
) as self._background_file:
422-
# TODO: Once CP6 is no longer supported, pass combined filename into OnDiskBitmap
423-
background = displayio.OnDiskBitmap(self._background_file)
424-
self._background_sprite = displayio.TileGrid(
425-
background,
426-
pixel_shader=getattr(
427-
background, "pixel_shader", displayio.ColorConverter()
428-
),
429-
# TODO: Once CP6 is no longer supported, replace the above line with below
430-
# pixel_shader=background.pixel_shader,
431-
)
432-
self._background_group.append(self._background_sprite)
417+
background = displayio.OnDiskBitmap(self._gamedirectory + "/" + filename)
418+
self._background_sprite = displayio.TileGrid(
419+
background,
420+
pixel_shader=background.pixel_shader,
421+
)
422+
self._background_group.append(self._background_sprite)
433423
if with_fade:
434424
self._display.refresh(target_frames_per_second=60)
435425
self.backlight_fade(1.0)

0 commit comments

Comments
 (0)