当前位置: 首页>>代码示例>>Python>>正文


Python sound.Sound类代码示例

本文整理汇总了Python中horizons.engine.sound.Sound的典型用法代码示例。如果您正苦于以下问题:Python Sound类的具体用法?Python Sound怎么用?Python Sound使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Sound类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init

	def init(self):
		"""Second initialization stage of engine"""
		self.engine.init()

		# Init stuff.
		self.eventmanager = self.engine.getEventManager()
		self.sound = Sound(self)
		self.imagemanager = self.engine.getImageManager()
		self.animationmanager = self.engine.getAnimationManager()
		self.targetrenderer = self.engine.getTargetRenderer()
		self.animationloader = None

		# Set game cursor.
		self.cursor = self.engine.getCursor()
		cursor_images = {
			'default':   'content/gui/images/cursors/cursor.png',
			'tearing':   'content/gui/images/cursors/cursor_tear.png',
			'attacking': 'content/gui/images/cursors/cursor_attack.png',
			'pipette':   'content/gui/images/cursors/cursor_pipette.png',
			'rename':    'content/gui/images/cursors/cursor_rename.png',
		}
		self.cursor_images = {k: self.imagemanager.load(v) for k, v in cursor_images.items()}
		self.cursor.set(self.cursor_images['default'])

		# Init pychan.
		# Enabling pychan's debug mode may have performance impacts.
		# Because of this, the default PychanDebug value is False.
		debug_pychan = self.get_fife_setting('PychanDebug')
		self.pychan.init(self.engine, debug_pychan)

		init_pychan()
		self._setting.apply()

		self._got_inited = True
开发者ID:MarkusHackspacher,项目名称:unknown-horizons,代码行数:34,代码来源:engine.py

示例2: init

	def init(self):
		"""Second initialization stage of engine"""
		self.engine.init()

		#init stuff
		self.eventmanager = self.engine.getEventManager()
		self.sound = Sound(self)
		self.imagemanager = self.engine.getImageManager()
		self.targetrenderer = self.engine.getTargetRenderer()
		self.animationloader = None

		#Set game cursor
		self.cursor = self.engine.getCursor()
		cursor_images = {
			'default':   'content/gui/images/cursors/cursor.png',
			'tearing':   'content/gui/images/cursors/cursor_tear.png',
			'attacking': 'content/gui/images/cursors/cursor_attack.png',
			'pipette':   'content/gui/images/cursors/cursor_pipette.png',
			'rename':    'content/gui/images/cursors/cursor_rename.png',
		}
		self.cursor_images = dict( (k, self.imagemanager.load(v)) for k, v in  cursor_images.iteritems() )
		self.cursor.set(self.cursor_images['default'])

		#init pychan
		debug_pychan = self.get_fife_setting('PychanDebug') # default is False
		self.pychan.init(self.engine, debug_pychan) # pychan debug mode may have performance impacts

		init_pychan()
		self._setting.apply()

		self._got_inited = True
开发者ID:JonathanMeans,项目名称:unknown-horizons,代码行数:31,代码来源:engine.py

示例3: init

	def init(self):
		"""Second initialisation stage of engine
		"""
		logToPrompt, logToFile, debugPychan = True, True, False
		if self._gotInited:
			return
		#start modules
		self.log = fifelog.LogManager(self.engine, 1 if logToPrompt else 0, 1 if logToFile else 0)
		#self.log.setVisibleModules('all')

		self.engine.init()

		#init stuff
		self.eventmanager = self.engine.getEventManager()
		#self.eventmanager.setNonConsumableKeys([fife.Key.ESCAPE, fife.Key.F10])
		self.sound = Sound(self)
		self.imagemanager = self.engine.getImageManager()
		self.targetrenderer = self.engine.getTargetRenderer()
		self.use_atlases = GFX.USE_ATLASES
		if self.use_atlases:
			self.animationloader = SQLiteAtlasLoader()
		else:
			self.animationloader = SQLiteAnimationLoader()

		#Set game cursor
		self.cursor = self.engine.getCursor()
		cursor_images = {
			'default':   'content/gui/images/cursors/cursor.png',
			'tearing':   'content/gui/images/cursors/cursor_tear.png',
			'attacking': 'content/gui/images/cursors/cursor_attack.png',
			'pipette':   'content/gui/images/cursors/cursor_pipette.png',
		  'rename':    'content/gui/images/cursors/cursor_rename.png',
		}
		self.cursor_images = dict( (k, self.imagemanager.load(v)) for k, v in  cursor_images.iteritems() )
		self.cursor.set( self.cursor_images['default'] )

		#init pychan
		self.pychan.init(self.engine, debugPychan)
		self.pychan.setupModalExecution(self.loop, self.breakLoop)
		self.console = self.pychan.manager.hook.guimanager.getConsole()

		init_pychan()

		self._setting_handler.apply_settings()

		self._gotInited = True
开发者ID:mage666,项目名称:unknown-horizons,代码行数:46,代码来源:engine.py

示例4: init

	def init(self):
		"""Second initialisation stage of engine
		"""
		self.engine.init()

		#init stuff
		self.eventmanager = self.engine.getEventManager()
		#self.eventmanager.setNonConsumableKeys([fife.Key.ESCAPE, fife.Key.F10])
		self.sound = Sound(self)
		self.imagemanager = self.engine.getImageManager()
		self.targetrenderer = self.engine.getTargetRenderer()
		self.use_atlases = GFX.USE_ATLASES
		if self.use_atlases:
			self.animationloader = SQLiteAtlasLoader()
		else:
			self.animationloader = SQLiteAnimationLoader()

		#Set game cursor
		self.cursor = self.engine.getCursor()
		cursor_images = {
			'default':   'content/gui/images/cursors/cursor.png',
			'tearing':   'content/gui/images/cursors/cursor_tear.png',
			'attacking': 'content/gui/images/cursors/cursor_attack.png',
			'pipette':   'content/gui/images/cursors/cursor_pipette.png',
			'rename':    'content/gui/images/cursors/cursor_rename.png',
		}
		self.cursor_images = dict( (k, self.imagemanager.load(v)) for k, v in  cursor_images.iteritems() )
		self.cursor.set( self.cursor_images['default'] )

		#init pychan
		debug_pychan = self.get_fife_setting('PychanDebug') # default is False
		self.pychan.init(self.engine, debug_pychan) # pychan debug mode may have performance impacts
		self.pychan.setupModalExecution(self.loop, self.breakLoop)
		self.console = self.pychan.manager.hook.guimanager.getConsole()

		init_pychan()
		self.pychanmanager = pychan.internal.get_manager()

		self._setting_handler.apply_settings()

		self._gotInited = True
开发者ID:acieroid,项目名称:unknown-horizons,代码行数:41,代码来源:engine.py

示例5: Fife


#.........这里部分代码省略.........
				# patch old values
				if user_settings_version <= 10:
					old_entries = entries
					entries = []
					for i in old_entries:
						if i[0] == UH_MODULE and i[1] == "Language":
							entries.append( (i[0], i[1], LANGUAGENAMES.get_by_value(i[2])) )
						else:
							entries.append(i)

				# write actual new file
				shutil.copy( PATHS.CONFIG_TEMPLATE_FILE, PATHS.USER_CONFIG_FILE )
				user_config_parser = SimpleXMLSerializer( _user_config_file )
				for modulename, entryname, value in entries:
					user_config_parser.set(modulename, entryname, value)
				user_config_parser.save()

		self._setting = SettingsDialog(app_name=UH_MODULE,
				                         settings_file=PATHS.USER_CONFIG_FILE,
				                         settings_gui_xml="settings.xml",
				                         changes_gui_xml="requirerestart.xml",
				                         default_settings_file=PATHS.CONFIG_TEMPLATE_FILE)

		self._setting_handler.add_settings()

	def init(self):
		"""Second initialisation stage of engine
		"""
		self.engine.init()

		#init stuff
		self.eventmanager = self.engine.getEventManager()
		#self.eventmanager.setNonConsumableKeys([fife.Key.ESCAPE, fife.Key.F10])
		self.sound = Sound(self)
		self.imagemanager = self.engine.getImageManager()
		self.targetrenderer = self.engine.getTargetRenderer()
		self.use_atlases = GFX.USE_ATLASES
		if self.use_atlases:
			self.animationloader = SQLiteAtlasLoader()
		else:
			self.animationloader = SQLiteAnimationLoader()

		#Set game cursor
		self.cursor = self.engine.getCursor()
		cursor_images = {
			'default':   'content/gui/images/cursors/cursor.png',
			'tearing':   'content/gui/images/cursors/cursor_tear.png',
			'attacking': 'content/gui/images/cursors/cursor_attack.png',
			'pipette':   'content/gui/images/cursors/cursor_pipette.png',
			'rename':    'content/gui/images/cursors/cursor_rename.png',
		}
		self.cursor_images = dict( (k, self.imagemanager.load(v)) for k, v in  cursor_images.iteritems() )
		self.cursor.set( self.cursor_images['default'] )

		#init pychan
		debug_pychan = self.get_fife_setting('PychanDebug') # default is False
		self.pychan.init(self.engine, debug_pychan) # pychan debug mode may have performance impacts
		self.pychan.setupModalExecution(self.loop, self.breakLoop)
		self.console = self.pychan.manager.hook.guimanager.getConsole()

		init_pychan()

		self._setting_handler.apply_settings()

		self._gotInited = True
开发者ID:DanielStephens,项目名称:unknown-horizons,代码行数:66,代码来源:engine.py

示例6: Fife


#.........这里部分代码省略.........

				# patch old values
				if user_settings_version <= 10:
					old_entries = entries
					entries = []
					for i in old_entries:
						if i[0] == UH_MODULE and i[1] == "Language":
							entries.append( (i[0], i[1], LANGUAGENAMES.get_by_value(i[2])) )
						else:
							entries.append(i)

				# write actual new file
				shutil.copy(PATHS.CONFIG_TEMPLATE_FILE, PATHS.USER_CONFIG_FILE)
				user_config_parser = SimpleXMLSerializer(_user_config_file)
				for modulename, entryname, value in entries:
					user_config_parser.set(modulename, entryname, value)
				user_config_parser.save()

		self._setting = SettingsDialog(app_name=UH_MODULE,
		                               settings_file=PATHS.USER_CONFIG_FILE,
		                               settings_gui_xml="settings.xml",
		                               changes_gui_xml="requirerestart.xml",
		                               default_settings_file=PATHS.CONFIG_TEMPLATE_FILE)

		self._setting_handler.add_settings()

	def init(self):
		"""Second initialization stage of engine
		"""
		self.engine.init()

		#init stuff
		self.eventmanager = self.engine.getEventManager()
		self.sound = Sound(self)
		self.imagemanager = self.engine.getImageManager()
		self.targetrenderer = self.engine.getTargetRenderer()
		self.animationloader = None

		#Set game cursor
		self.cursor = self.engine.getCursor()
		cursor_images = {
			'default':   'content/gui/images/cursors/cursor.png',
			'tearing':   'content/gui/images/cursors/cursor_tear.png',
			'attacking': 'content/gui/images/cursors/cursor_attack.png',
			'pipette':   'content/gui/images/cursors/cursor_pipette.png',
			'rename':    'content/gui/images/cursors/cursor_rename.png',
		}
		self.cursor_images = dict( (k, self.imagemanager.load(v)) for k, v in  cursor_images.iteritems() )
		self.cursor.set(self.cursor_images['default'])

		#init pychan
		debug_pychan = self.get_fife_setting('PychanDebug') # default is False
		self.pychan.init(self.engine, debug_pychan) # pychan debug mode may have performance impacts

		init_pychan()

		self._setting_handler.apply_settings()

		self._got_inited = True

	def init_animation_loader(self, use_atlases):
		# this method should not be called from init to catch any bugs caused by the loader changing after it.
		self.use_atlases = use_atlases
		if self.use_atlases:
			self.animationloader = SQLiteAtlasLoader()
		else:
开发者ID:Daenor,项目名称:unknown-horizons,代码行数:67,代码来源:engine.py

示例7: init

	def init(self):
		"""Second initialization stage of engine
		"""
		self.engine.init()
		
		# There is no default value for the LatestBackground setting inside the
		# settings-template.xml file. As this file is used to populate settings.xml
		# when the game is first run, we will examine the LatestBackground setting
		# to determine if the game has run before
		if not self.get_uh_setting('LatestBackground'):
			# The game hasn't run before (or the settings.xml file has been deleted)
			# set the game's resolution to the resolution that is closest to the
			# desktop's resolution and supported by the renderer
			
			# Get_screen_resolutions() returns all supported resolutions, sorted by width
			available_resolutions = get_screen_resolutions(self.get_fife_setting('ScreenResolution'))
			
			# Use the resolution that the game is currently set to as a baseline
			current_width = self.engine.getRenderBackend().getWidth()
			current_height = self.engine.getRenderBackend().getHeight()
			closest_width = current_width
			closest_height = current_height
			
			# Compare the desktop's resolution with the game's current resolution
			desktop_width = self.engine.getDeviceCaps().getDesktopWidth()
			desktop_height = self.engine.getDeviceCaps().getDesktopHeight()
			closest_width_difference = abs(desktop_width - current_width)
			closest_height_difference = abs(desktop_height - current_height)
			
			# Compare all available resolutions with the game's current resolution
			for available_resolution in available_resolutions:
				(width, height) = available_resolution.split('x')
				width_difference = abs(desktop_width - int(width))
				height_difference = abs(desktop_height - int(height))
				
				# If another available resolution is closer to the desktop's resolution
				if (width_difference <= closest_width_difference and
					height_difference <= closest_height_difference):
					# Update the closest resolution
					closest_width = width
					closest_width_difference = width_difference
					closest_height = height
					closest_height_difference = height_difference
			
			# We need to destroy and re-initialize the engine to force the change
			self.engine.destroy()
			self.set_fife_setting('ScreenResolution',str(closest_width)+'x'+str(closest_height))
			self.save_settings()
			self.engine_settings.setScreenWidth(int(closest_width))
			self.engine_settings.setScreenHeight(int(closest_height))
			self.engine.init()

		#init stuff
		self.eventmanager = self.engine.getEventManager()
		self.sound = Sound(self)
		self.imagemanager = self.engine.getImageManager()
		self.targetrenderer = self.engine.getTargetRenderer()
		self.animationloader = None

		#Set game cursor
		self.cursor = self.engine.getCursor()
		cursor_images = {
			'default':   'content/gui/images/cursors/cursor.png',
			'tearing':   'content/gui/images/cursors/cursor_tear.png',
			'attacking': 'content/gui/images/cursors/cursor_attack.png',
			'pipette':   'content/gui/images/cursors/cursor_pipette.png',
			'rename':    'content/gui/images/cursors/cursor_rename.png',
		}
		self.cursor_images = dict( (k, self.imagemanager.load(v)) for k, v in  cursor_images.iteritems() )
		self.cursor.set(self.cursor_images['default'])

		#init pychan
		debug_pychan = self.get_fife_setting('PychanDebug') # default is False
		self.pychan.init(self.engine, debug_pychan) # pychan debug mode may have performance impacts

		init_pychan()

		self._setting_handler.apply_settings()

		self._got_inited = True
开发者ID:STEVEOO6,项目名称:unknown-horizons,代码行数:80,代码来源:engine.py


注:本文中的horizons.engine.sound.Sound类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。