示例#1
0
    def _createPygameMixer(self):
        """Initialises the pyglet sound module"""
        try:
            import pyglet
            settings.sound_support = True
            import os.path
            if os.path.exists("sound.cfg"):
                config = ogre.ConfigFile()
                config.loadDirect("sound.cfg")
                music = config.getSetting("Music")
                if music == "Yes":
                    settings.music = True
                else:
                    settings.music = False

                sound = config.getSetting("Sound")
                if sound == "Yes":
                    settings.sound_effects = True
                else:
                    settings.sound_effects = False
        except ImportError:
            print "pyglet not found, sounds are disabled"
            settings.music = False
            settings.sound_effects = False
            settings.sound_support = False
示例#2
0
    def defineResources(self):
        cf = ogre.ConfigFile()
        cf.load(self.resourcesPath)
        seci = cf.getSectionIterator()

        while seci.hasMoreElements():
            secName = seci.peekNextKey()
            settings = seci.getNext()
            
            for item in settings:
                typeName = item.key
                archName = item.value
                ogre.ResourceGroupManager.getSingleton().addResourceLocation(archName, typeName, secName)
示例#3
0
文件: main.py 项目: ryankirkman/tote
    def defineResources(self):
        # Read the resources.cfg file and add all resource locations in it
        cf = ogre.ConfigFile()
        cf.load("resources.cfg")
        seci = cf.getSectionIterator()
        while seci.hasMoreElements():
            secName = seci.peekNextKey()
            settings = seci.getNext()

            for item in settings:
                typeName = item.key
                archName = item.value
                ogre.ResourceGroupManager.getSingleton().addResourceLocation(archName, typeName, secName)
示例#4
0
 def _setUpResources(self):
     """This sets up Ogre's resources, which are required to be in resources.cfg"""
     config = ogre.ConfigFile()
     config.load('resources.cfg')
     seci = config.getSectionIterator()
     while seci.hasMoreElements():
         secName = seci.peekNextKey()
         items = seci.getNext()
         for item in items:
             typeName = item.key
             archName = item.value
             ogre.ResourceGroupManager.getSingleton().addResourceLocation(
                 archName, typeName, secName)
示例#5
0
    def defineResources(self):
        cf = ogre.ConfigFile()
        cf.load("resources.cfg")

        #start looping through the parsed config file
        seci = cf.getSectionIterator()
        while seci.hasMoreElements():
            #aquire the section to get all contents out
            secName = seci.peekNextKey(
            )  #section name (which is the group of the resources)
            settings = seci.getNext()
            #
            for item in settings:
                typeName = item.key  #type of resource (zip, folder, etc)
                archName = item.value  #filename of the resource itself
                ogre.ResourceGroupManager.getSingleton().addResourceLocation(
                    archName, typeName, secName)
示例#6
0
    def _createSoundManager(self):
        """Creates the sound manager"""
        legacy = False
        if not hasattr(ogreal.SoundManager, "getDeviceList"):
            legacy = True
            print "legacy ogreal found"
            settings.sound_devices = ["Generic Software"]
        else:
            settings.sound_devices = ogreal.SoundManager.getDeviceList()

        if len(settings.sound_devices) == 0:
            print "no sound devices found"
            settings.music = False
            settings.sound_effects = False
            settings.sound_support = False
            return

        import os.path
        if os.path.exists("sound.cfg"):
            config = ogre.ConfigFile()
            config.loadDirect("sound.cfg")
            settings.current_sound_device = config.getSetting("Device")
            if settings.current_sound_device == "":
                settings.music = False
                settings.sound_effects = False
                return
            music = config.getSetting("Music")
            if music == "Yes":
                settings.music = True
            else:
                settings.music = False

            sound = config.getSetting("Sound")
            if sound == "Yes":
                settings.sound_effects = True
            else:
                settings.sound_effects = False
        else:
            settings.current_sound_device = "Generic Software"

        if legacy:
            self.soundManager = ogreal.SoundManager()
        else:
            self.soundManager = ogreal.SoundManager(
                settings.current_sound_device)
示例#7
0
 def _setUpResources(self):
     """This sets up Ogre's resources, which are required to be in
     resources.cfg."""
     config = ogre.ConfigFile()
     try:
         config.load('resources.cfg') 
     except ogre.OgreFileNotFoundException:
         try:
             config.load('../resources.cfg')
         except:
             raise                
     except:
         raise               
                 
     seci = config.getSectionIterator()
     while seci.hasMoreElements():
         SectionName = seci.peekNextKey()
         Section = seci.getNext()
         for item in Section:
             ogre.ResourceGroupManager.getSingleton().\
                 addResourceLocation(item.value, item.key, SectionName)
示例#8
0
	def onGraphics(self, evt):
		wm = cegui.WindowManager.getSingleton()
		if wm.getWindow("Graphics").isVisible():
			return

		self.graphics_items = []
		config = ogre.ConfigFile()
		config.loadDirect("ogre.cfg")
		self.current_system = settings.render_system.getName()
		config_map = settings.render_system.getConfigOptions()
		for c in config_map:
			if c.key == "Video Mode":
				video_modes = c.value.possibleValues
			elif c.key == "Anti aliasing":
				aa = c.value.possibleValues
			elif c.key == "FSAA":
				fsaa = c.value.possibleValues

		full_screen = config.getSetting("Full Screen", self.current_system)
		if full_screen == "Yes":
			self.full_screen = True
			wm.getWindow("Graphics/Fullscreen").setSelected(True)
		else:
			self.full_screen = False
			wm.getWindow("Graphics/Fullscreen").setSelected(False)

		self.video_mode = config.getSetting("Video Mode", self.current_system)
		res_win = helpers.setWidgetText("Graphics/Resolution", self.video_mode)
		for i in range(len(video_modes)):
			item = cegui.ListboxTextItem(video_modes[i])
			item.setAutoDeleted(False)
			self.graphics_items.append(item)
			res_win.addItem(item)

		driver_win = helpers.setWidgetText("Graphics/Driver", self.current_system)
		for value in settings.renderers:
			item = cegui.ListboxTextItem(value.getName())
			item.setAutoDeleted(False)
			self.graphics_items.append(item)
			driver_win.addItem(item)

		# Anti-aliasing comes under different names for opengl and direct3d
		self.fsaa = config.getSetting("FSAA", self.current_system)
		if len(self.fsaa) > 0:
			fsaa_win = helpers.setWidgetText("Graphics/AA", self.fsaa)
			for i in range(len(fsaa)):
				item = cegui.ListboxTextItem(fsaa[i])
				item.setAutoDeleted(False)
				self.graphics_items.append(item)
				fsaa_win.addItem(item)

		self.anti_aliasing = config.getSetting("Anti aliasing", self.current_system)
		if len(self.anti_aliasing) > 0:
			aa_win = helpers.setWidgetText("Graphics/AA", self.anti_aliasing)
			for i in range(len(aa)):
				item = cegui.ListboxTextItem(aa[i])
				item.setAutoDeleted(False)
				self.graphics_items.append(item)
				aa_win.addItem(item)

		helpers.toggleWindow("Graphics", True).activate()