示例#1
0
def main():
    """This function is the main function of the game."""
    pygame.init()

    try:
        Game.run()
    except FileNotFoundError as err:
        print(err.args[0])

    pygame.quit()
    exit()
示例#2
0

def initialize_logging() -> None:
    log_file = LOGGING_FILE
    clear_log(log_file)

    fmt = '%(asctime)s {} [%(levelname)s]  %(message)s'.format(VERSION)
    formatter = logging.Formatter(fmt)
    logger = logging.getLogger()
    logger.setLevel(LOG_LEVEL)

    file_logger = logging.FileHandler(log_file)
    file_logger.setFormatter(formatter)
    logger.addHandler(file_logger)

    console_logger = logging.StreamHandler()
    console_logger.setFormatter(formatter)
    logger.addHandler(console_logger)


if __name__ == '__main__':
    initialize_logging()
    logging.info('Start Application')

    initialize_pygame()
    view_manager = ViewManager()  # This instantiates the singleton class
    g = Game()

    g.run()
    sys.exit()