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


Python WindowProperties.getXSize方法代码示例

本文整理汇总了Python中pandac.PandaModules.WindowProperties.getXSize方法的典型用法代码示例。如果您正苦于以下问题:Python WindowProperties.getXSize方法的具体用法?Python WindowProperties.getXSize怎么用?Python WindowProperties.getXSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pandac.PandaModules.WindowProperties的用法示例。


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

示例1: set

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getXSize [as 别名]
 def set(self, pipe, width, height, fullscreen, embedded):
     self.notify.debugStateCall(self)
     state = False
     self.notify.info('SET')
     if self.restrict_to_embedded:
         fullscreen = 0
         embedded = 1
     if embedded:
         if base.appRunner.windowProperties:
             width = base.appRunner.windowProperties.getXSize()
             height = base.appRunner.windowProperties.getYSize()
     self.current_pipe = base.pipe
     self.current_properties = WindowProperties(base.win.getProperties())
     properties = self.current_properties
     self.notify.debug('DISPLAY PREVIOUS:')
     self.notify.debug('  EMBEDDED:   %s' % bool(properties.getParentWindow()))
     self.notify.debug('  FULLSCREEN: %s' % bool(properties.getFullscreen()))
     self.notify.debug('  X SIZE:     %s' % properties.getXSize())
     self.notify.debug('  Y SIZE:     %s' % properties.getYSize())
     self.notify.debug('DISPLAY REQUESTED:')
     self.notify.debug('  EMBEDDED:   %s' % bool(embedded))
     self.notify.debug('  FULLSCREEN: %s' % bool(fullscreen))
     self.notify.debug('  X SIZE:     %s' % width)
     self.notify.debug('  Y SIZE:     %s' % height)
     if self.current_pipe == pipe and bool(self.current_properties.getParentWindow()) == bool(embedded) and self.current_properties.getFullscreen() == fullscreen and self.current_properties.getXSize() == width and self.current_properties.getYSize() == height:
         self.notify.info('DISPLAY NO CHANGE REQUIRED')
         state = True
     else:
         properties = WindowProperties()
         properties.setSize(width, height)
         properties.setFullscreen(fullscreen)
         properties.setParentWindow(0)
         if embedded:
             if base.appRunner.windowProperties:
                 properties = base.appRunner.windowProperties
         original_sort = base.win.getSort()
         if self.resetWindowProperties(pipe, properties):
             self.notify.debug('DISPLAY CHANGE SET')
             properties = base.win.getProperties()
             self.notify.debug('DISPLAY ACHIEVED:')
             self.notify.debug('  EMBEDDED:   %s' % bool(properties.getParentWindow()))
             self.notify.debug('  FULLSCREEN: %s' % bool(properties.getFullscreen()))
             self.notify.debug('  X SIZE:     %s' % properties.getXSize())
             self.notify.debug('  Y SIZE:     %s' % properties.getYSize())
             if bool(properties.getParentWindow()) == bool(embedded) and properties.getFullscreen() == fullscreen and properties.getXSize() == width and properties.getYSize() == height:
                 self.notify.info('DISPLAY CHANGE VERIFIED')
                 state = True
             else:
                 self.notify.warning('DISPLAY CHANGE FAILED, RESTORING PREVIOUS DISPLAY')
                 self.restoreWindowProperties()
         else:
             self.notify.warning('DISPLAY CHANGE FAILED')
             self.notify.warning('DISPLAY SET - BEFORE RESTORE')
             self.restoreWindowProperties()
             self.notify.warning('DISPLAY SET - AFTER RESTORE')
         base.win.setSort(original_sort)
         base.graphicsEngine.renderFrame()
         base.graphicsEngine.renderFrame()
     return state
开发者ID:gamerdave54321,项目名称:Toontown-House-Code,代码行数:61,代码来源:DisplayOptions.py

示例2: __init__

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getXSize [as 别名]
class DisplayOptions:
    notify = DirectNotifyGlobal.directNotify.newCategory('DisplayOptions')
    
    def __init__(self):
        self.restore_failed = False
        self.loadFromSettings()

    
    def loadFromSettings(self):
        return
        Settings.readSettings()
        mode = not Settings.getWindowedMode()
        music = Settings.getMusic()
        sfx = Settings.getSfx()
        toonChatSounds = Settings.getToonChatSounds()
        musicVol = Settings.getMusicVolume()
        sfxVol = Settings.getSfxVolume()
        resList = [
            (640, 480),
            (800, 600),
            (1024, 768),
            (1280, 1024),
            (1600, 1200)]
        res = resList[Settings.getResolution()]
        embed = Settings.getEmbeddedMode()
        self.notify.debug('before prc settings embedded mode=%s' % str(embed))
        self.notify.debug('before prc settings full screen mode=%s' % str(mode))
        if mode == None:
            mode = 1
        
        if res == None:
            res = (800, 600)
        
        if not Settings.doSavedSettingsExist():
            self.notify.info('loadFromSettings: No settings; isDefaultEmbedded=%s' % self.isDefaultEmbedded())
            embed = self.isDefaultEmbedded()
        
        if embed and not self.isEmbeddedPossible():
            self.notify.warning('Embedded mode is not possible.')
            embed = False
        
        if not mode and not self.isWindowedPossible():
            self.notify.warning('Windowed mode is not possible.')
            mode = True
        
        loadPrcFileData('toonBase Settings Window Res', 'win-size %s %s' % (res[0], res[1]))
        self.notify.debug('settings resolution = %s' % str(res))
        loadPrcFileData('toonBase Settings Window FullScreen', 'fullscreen %s' % mode)
        self.notify.debug('settings full screen mode=%s' % str(mode))
        loadPrcFileData('toonBase Settings Music Active', 'audio-music-active %s' % music)
        loadPrcFileData('toonBase Settings Sound Active', 'audio-sfx-active %s' % sfx)
        loadPrcFileData('toonBase Settings Music Volume', 'audio-master-music-volume %s' % musicVol)
        loadPrcFileData('toonBase Settings Sfx Volume', 'audio-master-sfx-volume %s' % sfxVol)
        loadPrcFileData('toonBase Settings Toon Chat Sounds', 'toon-chat-sounds %s' % toonChatSounds)
        self.settingsFullScreen = mode
        self.settingsWidth = res[0]
        self.settingsHeight = res[1]
        self.settingsEmbedded = embed
        self.notify.debug('settings embedded mode=%s' % str(self.settingsEmbedded))
        self.notify.info('settingsFullScreen = %s, embedded = %s width=%d height=%d' % (self.settingsFullScreen, self.settingsEmbedded, self.settingsWidth, self.settingsHeight))

    
    def restrictToEmbedded(self, restrict, change_display = True):
        if base.appRunner is None or base.appRunner.windowProperties is None:
            restrict = 0
        
        self.restrict_to_embedded = choice(restrict, 1, 0)
        self.notify.debug('restrict_to_embedded: %s' % self.restrict_to_embedded)
        if change_display:
            self.set(base.pipe, self.settingsWidth, self.settingsHeight, self.settingsFullScreen, self.settingsEmbedded)
        

    
    def set(self, pipe, width, height, fullscreen, embedded):
        self.notify.debugStateCall(self)
        state = False
        self.notify.info('SET')
        if self.restrict_to_embedded:
            fullscreen = 0
            embedded = 1
        
        if embedded:
            if base.appRunner.windowProperties:
                width = base.appRunner.windowProperties.getXSize()
                height = base.appRunner.windowProperties.getYSize()
            
        
        self.current_pipe = base.pipe
        self.current_properties = WindowProperties(base.win.getProperties())
        properties = self.current_properties
        self.notify.debug('DISPLAY PREVIOUS:')
        self.notify.debug('  EMBEDDED:   %s' % bool(properties.getParentWindow()))
        self.notify.debug('  FULLSCREEN: %s' % bool(properties.getFullscreen()))
        self.notify.debug('  X SIZE:     %s' % properties.getXSize())
        self.notify.debug('  Y SIZE:     %s' % properties.getYSize())
        self.notify.debug('DISPLAY REQUESTED:')
        self.notify.debug('  EMBEDDED:   %s' % bool(embedded))
        self.notify.debug('  FULLSCREEN: %s' % bool(fullscreen))
        self.notify.debug('  X SIZE:     %s' % width)
        self.notify.debug('  Y SIZE:     %s' % height)
#.........这里部分代码省略.........
开发者ID:OldToontown,项目名称:OldToontown,代码行数:103,代码来源:DisplayOptions.py

示例3: getScreenRatio

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getXSize [as 别名]
def getScreenRatio():
	props = WindowProperties(base.win.getProperties())
	return float(props.getXSize()) / float(props.getYSize())
开发者ID:Vetrik,项目名称:python-utils,代码行数:5,代码来源:basicfunctions.py

示例4: Game

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import getXSize [as 别名]

#.........这里部分代码省略.........
		
	def spawnEnemies(self):#now we spawn our enemies
		while((len(self.eSpawnList) > 0) and self.eSpawnList[0]["time"] < self.globalTime):
			for val in self.eSpawnList[0]["enemies"]:
				if val["type"] == RUSH_ENEMY:
					#add an enemy
					tempEnemy = RushEnemy(self, val["xVal"], val["yVal"], val["zVal"])
					self.configureEnemy(tempEnemy)
				elif val["type"] == DRONE_ENEMY:
					#add an enemy
					tempEnemy = DroneEnemy(self, self.player, val["xVal"], val["yVal"], val["zVal"])
					self.configureEnemy(tempEnemy)
				elif val["type"] == SHOOTING_ENEMY:
					#add an enemy
					tempEnemy = ShootingEnemy(self, val["xVal"], val["yVal"], val["zVal"])
					self.configureEnemy(tempEnemy)
				else: 
					pass
				
			del self.eSpawnList[0]#del
			
	
	def configureEnemy(self, tempEnemy):#after making an enemy configure it for the game
		numString = str(self.nextEnemy)
		tempEnemy.setName("enemy" + numString)
		tempEnemy.reparentTo(self.unitNodePath)
		tempEnemy.nodePath = self.render.find("enemy1")
		self.actors["enemy" + numString] = tempEnemy
		self.nextEnemy = self.nextEnemy + 1
		self.enemies.append(tempEnemy)
		
	
	def rotateCamera(self):
		if self.controlScheme.mouseX > self.winProps.getXSize():
			self.camera.setH(-(self.winProps.getXSize() - 20) * 0.5)
		else:
			self.camera.setH(-self.controlScheme.mouseX * 0.5)
	
	def updateCamera(self, elapsedTime):
		#update the camera's heading based on the mouse's x position
		if self.controlScheme.recheckMouse():
			self.camera.setH(-self.controlScheme.mouseX * 0.5)
		else:
			self.rotateCamera()
		
		#update the camera's pitch and vertical position based on the mouse's y position
		self.cameraVOffset = min(self.screenHeight, max(0, self.controlScheme.mouseY)) / self.screenHeight * 25 + 4
		self.cameraHOffset = self.cameraVOffset * 0.8 + 30
		self.camera.setP(atan2(-self.cameraVOffset * 0.7, self.cameraHOffset) \
							* 180 / pi)
		
		#update the camera to point at the player
		self.camera.setPos(self.player.getX() + self.cameraHOffset * sin(self.camera.getH() * pi / 180),
						   self.player.getY() - self.cameraHOffset * cos(self.camera.getH() * pi / 180),
						   self.player.getZ() + 0.3 + self.cameraVOffset)
	
	def selectTarget(self):
		"""Finds the closest shootable object and returns it"""

		#traverse all objects in render
		self.mPickerTraverser.traverse(self.unitNodePath)

		if (self.mCollisionQue.getNumEntries() > 0):
			self.mCollisionQue.sortEntries()
			for i in range(0, self.mCollisionQue.getNumEntries()):
				entry = self.mCollisionQue.getEntry(i)
开发者ID:tom-anesta,项目名称:team-conventions,代码行数:70,代码来源:main.py


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