Skip to content

Commit

Permalink
fixup pyboy.game_wrapper as property
Browse files Browse the repository at this point in the history
  • Loading branch information
Baekalfen committed Dec 14, 2023
1 parent 093759b commit a0585cf
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion extras/examples/gamewrapper_kirby.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
pyboy.set_emulation_speed(0)
assert pyboy.cartridge_title() == "KIRBY DREAM LA"

kirby = pyboy.game_wrapper()
kirby = pyboy.game_wrapper
kirby.start_game()

assert kirby.score == 0
Expand Down
2 changes: 1 addition & 1 deletion extras/examples/gamewrapper_mario.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
pyboy.set_emulation_speed(0)
assert pyboy.cartridge_title() == "SUPER MARIOLAN"

mario = pyboy.game_wrapper()
mario = pyboy.game_wrapper
mario.start_game()

assert mario.score == 0
Expand Down
2 changes: 1 addition & 1 deletion extras/examples/gamewrapper_tetris.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
pyboy.set_emulation_speed(0)
assert pyboy.cartridge_title() == "TETRIS"

tetris = pyboy.game_wrapper()
tetris = pyboy.game_wrapper
tetris.start_game(timer_div=0x00) # The timer_div works like a random seed in Tetris

tetromino_at_0x00 = tetris.next_tetromino()
Expand Down
26 changes: 26 additions & 0 deletions tests/test_game_wrapper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# License: See LICENSE.md file
# GitHub: https://github.com/Baekalfen/PyBoy
#

import os
import platform
import sys

import numpy as np
import pytest

from pyboy import PyBoy, WindowEvent

py_version = platform.python_version()[:3]
is_pypy = platform.python_implementation() == "PyPy"


def test_game_wrapper_basics(default_rom):
pyboy = PyBoy(default_rom, window_type="null")
pyboy.set_emulation_speed(0)

generic_wrapper = pyboy.game_wrapper
assert generic_wrapper is not None
# pyboy.game_area()
pyboy.stop()

0 comments on commit a0585cf

Please sign in to comment.