How to use the pyboy.logger.logger.info function in pyboy

To help you get started, we’ve selected a few pyboy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Baekalfen / PyBoy / pyboy / plugins / debug.py View on Github external
def handle_events(self, events):
        global mark_counter, marked_tiles

        self.tilemap.refresh_lcdc()

        # Feed events into the loop
        events = BaseDebugWindow.handle_events(self, events)
        for event in events:
            if event == WindowEvent._INTERNAL_MOUSE and event.window_id == self.window_id:
                if event.mouse_button == 0:
                    tile_x, tile_y = event.mouse_x // self.scale // 8, event.mouse_y // self.scale // 8
                    tile_identifier = self.tilemap.tile_identifier(tile_x, tile_y)
                    logger.info(f"Tile clicked on {tile_x}, {tile_y}")
                    marked_tiles.add(
                        MarkedTile(tile_identifier=tile_identifier, mark_id="TILE", mark_color=MARK[mark_counter])
                    )
                    mark_counter += 1
                    mark_counter %= len(MARK)
                elif event.mouse_button == 1:
                    marked_tiles.clear()
            elif event == WindowEvent._INTERNAL_MARK_TILE:
                marked_tiles.add(event.tile_identifier)

        return events
github Baekalfen / PyBoy / pyboy / screenrecorder.py View on Github external
def save(self, path=None, fps=60):
        if not Image:
            logger.warning("ScreenRecorder: No recording to save. Missing dependency \"Pillow\".")
            return

        logger.info("ScreenRecorder saving...")

        if path is None:
            directory = os.path.join(os.path.curdir, "recordings")
            if not os.path.exists(directory):
                os.makedirs(directory, mode=0o755)
            path = os.path.join(directory, time.strftime(f"{self.gamename}-%Y.%m.%d-%H.%M.%S.gif"))

        if self.frames:
            self.frames[0].save(path, save_all=True, interlace=False,
                                loop=0, optimize=True,
                                append_images=self.frames[1:],
                                duration=int(round(1000 / fps, -1)))

            logger.info("Screen recording saved in {}".format(path))
        else:
            logger.error("Screen recording failed: no frames")
github Baekalfen / PyBoy / pyboy / pyboy.py View on Github external
def stop(self, save=True):
        """
        Gently stops the emulator and all sub-modules.

        Args:
            save (bool): Specify whether to save the game upon stopping. It will always be saved in a file next to the
                provided game-ROM.
        """
        logger.info("###########################")
        logger.info("# Emulator is turning off #")
        logger.info("###########################")
        self.plugin_manager.stop()
        self.mb.stop(save)
github Baekalfen / PyBoy / pyboy / screenrecorder.py View on Github external
logger.info("ScreenRecorder saving...")

        if path is None:
            directory = os.path.join(os.path.curdir, "recordings")
            if not os.path.exists(directory):
                os.makedirs(directory, mode=0o755)
            path = os.path.join(directory, time.strftime(f"{self.gamename}-%Y.%m.%d-%H.%M.%S.gif"))

        if self.frames:
            self.frames[0].save(path, save_all=True, interlace=False,
                                loop=0, optimize=True,
                                append_images=self.frames[1:],
                                duration=int(round(1000 / fps, -1)))

            logger.info("Screen recording saved in {}".format(path))
        else:
            logger.error("Screen recording failed: no frames")
github Baekalfen / PyBoy / pyboy / plugins / screen_recorder.py View on Github external
def handle_events(self, events):
        for event in events:
            if event == WindowEvent.SCREEN_RECORDING_TOGGLE:
                self.recording ^= True
                if not self.recording:
                    self.save()
                else:
                    logger.info("ScreenRecorder started")
                break
        return events
github Baekalfen / PyBoy / pyboy / window / window_dummy.py View on Github external
def set_title(self, title):
        if self.enable_title:
            logger.info("DummyWindow set title: %s" % title)