def abort_event(self): """ Queued event for changing to the ending titlecard. """ video.reset_renderers() import alpha_titlecard scene.load_scene(alpha_titlecard.TitleCard, True, exiting=True)
def score_event(self): """ Loads and runs the high score table. """ video.remove_renderer(self.copyright.render) import score scene.load_scene(score.ScoreScene)
def play_event(self): """ Loads and runs the game scene. """ video.remove_renderer(self.copyright.render) import game scene.load_scene(game.GameScene)
def bootstrap(): """ Loads the title menu in a manner that keeps the scene data from being persistent in memory. """ import title scene.load_scene(title.TitleScene, block=True)
def change_scene(self): """ Destroys all nonessential renderers and calls the title scene in. """ video.remove_renderer(video.draw_clouds) video.remove_renderer(self.render_scores) if self.menu: video.remove_renderer(self.menu.render_all) import title scene.load_scene(title.TitleScene, show_splash=False)
def exit_event(self): """ Remaining post-game over cleanup before the game changes scenes. """ video.remove_renderer(self.game_over_bg.render) video.remove_renderer(self.game_over.render) video.remove_renderer(self.lower_particle_renderer) if self.scene_args: import score scene.load_scene(score.ScoreScene, **self.scene_args) else: import title scene.load_scene(title.TitleScene, show_splash=False)
def main(argv): # Parse script arguments try: opts, _ = getopt.getopt(argv, "s:", ["scene="]) except getopt.GetoptError: print_script_usage() sys.exit(2) scene = None for opt, arg in opts: if opt in ("-s", "--scene"): scene = load_scene(arg) if scene is None: print_script_usage() sys.exit(2) print_R_script(scene)
def main(argv): # Parse script arguments try: opts, _ = getopt.getopt(argv, "s:t:c:d", ["scene=", "tree=", "classifier=", "double-step"]) except getopt.GetoptError: print_script_usage() sys.exit(2) features = featuresfirststep.all_features_dict() scene = None tree = None classifier = None step_size = 1 for opt, arg in opts: if opt in ("-s", "--scene"): scene = load_scene(arg) elif opt in ("-t", "--tree"): tree = evaluatetree.read_decision_tree(arg, features) elif opt in ("-c", "--classifier"): if arg == "highest": classifier = featuresfirststep.highest_on_left elif arg == "nearest": classifier = featuresfirststep.nearest_on_left elif arg == "near_high": classifier = featuresfirststep.highest_and_near_on_left elif opt in ("-d", "--double-step"): step_size = 2 if scene is None or tree is None: print_script_usage() sys.exit(2) print_R_script(scene, tree, classifier, step_size)
def main(argv): raytracer = Raytracer() scene = load_scene(os.path.join("data", argv[1])) image = raytracer.trace(scene.get_scene(), aa=False) pygame.image.save(image, os.path.join("results", argv[1] + ".png"))