Example #1
0
    def test_scene_with_menu(self):
        game = Game("Test",
                    "1.0",
                    "1.0",
                    "testpyvida",
                    fps=16,
                    afps=16,
                    resolution=(1680, 1050))
        game.autoscale = False
        game.working_directory = "/home/luke/Projects/pyvida/test_data"
        mx, my = game.resolution[0] / 2 - 100, 140  # game.resolution[1]-50
        game.add(MenuFactory("menu", (mx, my)))

        game.immediate_menu_from_factory("menu", [
            ("menu_new", MagicMock()),
            ("menu_old", MagicMock()),
        ])

        game.init()
        game.smart()
        game.queue_load_state("title", "initial")
        game.camera.scene("title")
        game.set_menu(*["menu_new", "menu_old"], clear=True)
        game.menu.show()

        game.update()  # run events

        assert game.w == 1680
        assert not game.autoscale
        assert game.scene == game.scenes["title"]
        assert game.scene.layers[0] == "title_background"
        assert game.scene.get_object("logo")
Example #2
0
def create_basic_scene(resolution=(1680, 1050), with_update=False):
    game = Game("Test",
                "1.0",
                "1.0",
                "testpyvida",
                fps=16,
                afps=16,
                resolution=resolution)
    game.autoscale = False
    game.working_directory = "/home/luke/Projects/pyvida/test_data"
    game.init()
    game.smart()
    game.queue_load_state("title", "initial")
    game.camera.scene("title")
    if with_update:
        game.update()  # perform all the queued events
    return game
Example #3
0
    def test_scene_with_item(self):
        game = Game("Test",
                    "1.0",
                    "1.0",
                    "testpyvida",
                    fps=16,
                    afps=16,
                    resolution=(1680, 1050))
        game.autoscale = False
        game.working_directory = "/home/luke/Projects/pyvida/test_data"
        game.init()
        game.smart()
        game.queue_load_state("title", "initial")
        game.camera.scene("title")

        game.update()  # run events

        logo = game.scene.get_object("logo")
        assert game.w == 1680
        assert not game.autoscale
        assert game.scene == game.scenes["title"]
        assert game.scene.layers[0] == "title_background"
        assert logo