diff --git a/adafruit_pyoa.py b/adafruit_pyoa.py index c456d02..562a96f 100755 --- a/adafruit_pyoa.py +++ b/adafruit_pyoa.py @@ -401,22 +401,12 @@ def set_background(self, filename, *, with_fade=True): self._background_group.pop() if filename: - if self._background_file: - self._background_file.close() - with open( - self._gamedirectory + "/" + filename, "rb" - ) as self._background_file: - # TODO: Once CP6 is no longer supported, pass combined filename into OnDiskBitmap - background = displayio.OnDiskBitmap(self._background_file) - self._background_sprite = displayio.TileGrid( - background, - pixel_shader=getattr( - background, "pixel_shader", displayio.ColorConverter() - ), - # TODO: Once CP6 is no longer supported, replace the above line with below - # pixel_shader=background.pixel_shader, - ) - self._background_group.append(self._background_sprite) + background = displayio.OnDiskBitmap(self._gamedirectory + "/" + filename) + self._background_sprite = displayio.TileGrid( + background, + pixel_shader=background.pixel_shader, + ) + self._background_group.append(self._background_sprite) if with_fade: self._display.refresh(target_frames_per_second=60) self.backlight_fade(1.0)