def main(options, args): """Start the engine and the game""" registerSounds() registerMusic() registerGraphics() registerEvents() # # Change theme settings if options.theme: theme.updateFromString(options.theme) # # Create the engine engine = startEngine(options) engine.linkEvent(serge.events.E_BEFORE_STOP, stoppingNow) # # Muting mute = serge.blocks.actors.MuteButton("mute-button", "ui", alpha=G("mute-button-alpha")) serge.blocks.utils.addMuteButtonToWorlds(mute, center_position=G("mute-button-position")) # if options.musicoff: mute.toggleSound() # # Initialise the main logic registerAchievements(options) mainscreen.main(options) startscreen.main(options) helpscreen.main(options) creditsscreen.main(options) # if options.debug: serge.builder.builder.main(engine, options.framerate) else: engine.run(options.framerate)
def main(options, args): """Start the engine and the game""" # # Create the high scores if options.high_score: createHighScores(options) # # Create the engine engine = startEngine(options) engine.linkEvent(serge.events.E_BEFORE_STOP, stoppingNow) # registerSounds() registerMusic() registerGraphics() registerEvents() # # Record a movie if options.movie: serge.blocks.utils.RecordDesktop(options.movie) # # Change theme settings if options.theme: theme.updateFromString(options.theme) # # Muting mute = serge.blocks.actors.MuteButton('mute-button', 'ui', alpha=G('mute-button-alpha')) serge.blocks.utils.addMuteButtonToWorlds( mute, center_position=G('mute-button-position')) # if options.musicoff: mute.toggleSound() # # Initialise the main logic registerAchievements(options) mainscreen.main(options) startscreen.main(options) helpscreen.main(options) creditsscreen.main(options) # if options.debug: serge.builder.builder.main(engine, options.framerate) else: engine.run(options.framerate)
def main(options, args, observation): """Start the engine and the game""" # # Set the levels to use - this allows us to switch to AI testing # levels rather than the main levels if options.test: import tests theme.setProperty('start-level', 1) common.levels = tests # # Check networkx install if not serge.blocks.utils.checkNetworkXVersion(1.8): return # # Create the high scores if options.high_score: createHighScores(options) # # Create the engine engine = startEngine(options) engine.linkEvent(serge.events.E_BEFORE_STOP, stoppingNow) engine.addWorld(common.TWEENER) # registerSounds() registerMusic() registerGraphics() registerEvents() # # Record a movie if options.movie: serge.blocks.utils.RecordDesktop(options.movie) # # Change theme settings if options.theme: theme.updateFromString(options.theme) # # Muting mute = serge.blocks.actors.MuteButton('mute-button', 'ui', alpha=G('mute-button-alpha')) serge.blocks.utils.addMuteButtonToWorlds( mute, center_position=G('mute-button-position')) # if options.muted: mute.toggleSound() if options.music_off: serge.sound.Music.toggle() # # Initialise the main logic registerAchievements(options) mainscreen.main(options, observation) startscreen.main(options) helpscreen.main(options) creditsscreen.main(options) levelscreen.main(options) actionreplayscreen.main(options) randomlevelscreen.main(options) # if options.debug: serge.builder.builder.main(engine, options.framerate) else: engine.run(options.framerate)
def main(options, args): """Start the engine and the game""" # # For ropes and things we typically need a higher number of iterations serge.zone.PHYSICS_ITERATIONS = 100 # # Create the engine engine = startEngine(options) engine.linkEvent(serge.events.E_BEFORE_STOP, stoppingNow) # registerSounds() registerMusic() registerGraphics() registerEvents() # # Change theme settings if options.theme: theme.updateFromString(options.theme) # # Muting mute = serge.blocks.actors.MuteButton('mute-button', 'ui', alpha=G('mute-button-alpha')) serge.blocks.utils.addMuteButtonToWorlds(mute, center_position=G('mute-button-position')) # if options.musicoff: mute.toggleSound() # # Initialise the main logic globals = serge.blocks.singletons.Store.registerItem('globals') globals.history = history.History('history', 'history') globals.last_cave_name = 'RANDOM-CAVE' # registerAchievements(options) if options.skip: mainscreen.main(options) else: startscreen.main(options) # # Force a rendering of the overlay - this puts # up the "loading ..." screen so the user has something # to see while we create the cave and trees etc w = engine.getWorld('start-screen') w.log.info('Rendering overlay') w.renderTo(engine.getRenderer(), 1000) engine.getRenderer().render() pygame.display.flip() # helpscreen.main(options) creditsscreen.main(options) namescreen.main(options) collectionscreen.main(options) # # if options.movie: serge.blocks.utils.RecordDesktop(options.movie) if options.debug: serge.builder.builder.main(engine, options.framerate) else: try: engine.run(options.framerate) except: # Make sure this event is raised so that any workers can be killed engine.processEvent((serge.events.E_BEFORE_STOP, None)) raise # # Display profile statistic if needed if options.engine_profile: prof = engine.getProfiler() data = [(prof.byTag(n).get('renderActor', (0,0))[1], n) for n in prof.getTags()] data.sort() data.reverse() print '\n\nEngine profiling\n\nTag\tTime(s)' for tme, tag in data: print '%s\t%s' % (tag, tme) print '\n\n'