Skip to content
Snippets Groups Projects
Verified Commit 0fa59770 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

chore: ordering of number

Also made Union more explicit, raises Python3 compatibility.
parent 96e51180
Branches
Tags
1 merge request!36Support for Python
Pipeline #3620 passed
...@@ -4,7 +4,7 @@ from glob import glob ...@@ -4,7 +4,7 @@ from glob import glob
from shutil import rmtree from shutil import rmtree
from tempfile import mkdtemp from tempfile import mkdtemp
from contextlib import contextmanager from contextlib import contextmanager
from typing import Any from typing import Any, Union
from PIL.Image import Image, frombytes from PIL.Image import Image, frombytes
...@@ -28,9 +28,9 @@ class GameBoyMode(Enum): ...@@ -28,9 +28,9 @@ class GameBoyMode(Enum):
class GameBoy: class GameBoy:
_frame_index: int = 0 _frame_index: int = 0
_start_frame: int | None _start_frame: Union[int, None]
_frame_gap: int _frame_gap: int
_capture_temp_dir: str | None _capture_temp_dir: Union[str, None]
def __init__( def __init__(
self, self,
...@@ -195,7 +195,7 @@ This is a [Game Boy](https://en.wikipedia.org/wiki/Game_Boy) emulator built usin ...@@ -195,7 +195,7 @@ This is a [Game Boy](https://en.wikipedia.org/wiki/Game_Boy) emulator built usin
def _on_next_frame(self): def _on_next_frame(self):
if self._next_frame != None and self._frame_index >= self._next_frame: if self._next_frame != None and self._frame_index >= self._next_frame:
self._next_frame = self._next_frame + self._frame_gap self._next_frame = self._next_frame + self._frame_gap
self.save_image(f"{self._capture_temp_dir}/frame_{self._frame_index}.png") self.save_image(f"{self._capture_temp_dir}/frame_{self._frame_index:08d}.png")
def _start_capture(self, fps=5): def _start_capture(self, fps=5):
self._next_frame = self._frame_index + self._frame_gap self._next_frame = self._frame_index + self._frame_gap
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment