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


Python WindowProperties.setOrigin方法代码示例

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


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

示例1: setupWindow

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
    def setupWindow(self, windowType, x, y, width, height,
                    parent):
        """ Applies the indicated window parameters to the prc
        settings, for future windows; or applies them directly to the
        main window if the window has already been opened.  This is
        called by the browser. """

        if self.started and base.win:
            # If we've already got a window, this must be a
            # resize/reposition request.
            wp = WindowProperties()
            if x or y or windowType == 'embedded':
                wp.setOrigin(x, y)
            if width or height:
                wp.setSize(width, height)
            if windowType == 'embedded':
                wp.setParentWindow(parent)
            wp.setFullscreen(False)
            base.win.requestProperties(wp)
            self.windowProperties = wp
            return

        # If we haven't got a window already, start 'er up.  Apply the
        # requested setting to the prc file, and to the default
        # WindowProperties structure.

        self.__clearWindowProperties()

        if windowType == 'hidden':
            data = 'window-type none\n'
        else:
            data = 'window-type onscreen\n'

        wp = WindowProperties.getDefault()

        wp.clearParentWindow()
        wp.clearOrigin()
        wp.clearSize()

        wp.setFullscreen(False)
        if windowType == 'fullscreen':
            wp.setFullscreen(True)

        if windowType == 'embedded':
            wp.setParentWindow(parent)

        if x or y or windowType == 'embedded':
            wp.setOrigin(x, y)

        if width or height:
            wp.setSize(width, height)

        self.windowProperties = wp
        self.windowPrc = loadPrcFileData("setupWindow", data)
        WindowProperties.setDefault(wp)

        self.gotWindow = True

        # Send this call to the main thread; don't call it directly.
        messenger.send('AppRunner_startIfReady', taskChain = 'default')
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:62,代码来源:AppRunner.py

示例2: bindToWindow

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
 def bindToWindow(self, windowHandle):
     wp = WindowProperties().getDefault()
     wp.setOrigin(self._x, self._y)
     wp.setSize(self._width, self._height)
     wp.setParentWindow(windowHandle)
     base.openDefaultWindow(props=wp)
     self.wp = wp
开发者ID:kit-ipe,项目名称:sensorsEditor,代码行数:9,代码来源:rendererPanda3d.py

示例3: resize_panda_window

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
 def resize_panda_window(self, widget, request) :
     props = WindowProperties().getDefault()
     props = WindowProperties(self.base.win.getProperties())
     props.setOrigin(0, 0)
     props.setSize(request.width, request.height)
     props.setParentWindow(widget.window.xid)
     self.base.win.requestProperties(props)
开发者ID:drewp,项目名称:blockstack,代码行数:9,代码来源:gamescene.py

示例4: onSize

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
 def onSize(self, evt):
     """Invoked when the viewport is resized."""
     if self.win != None:
         wp = WindowProperties()
         wp.setOrigin(0, 0)
         wp.setSize(self.ClientSize.GetWidth(), self.ClientSize.GetHeight())
         self.win.requestProperties(wp)
开发者ID:highattack30,项目名称:panda3d-editor,代码行数:9,代码来源:pViewport.py

示例5: OnResize

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
 def OnResize( self, event ):
     """When the wx-panel is resized, fit the panda3d window into it."""
     frame_size = event.GetSize()
     wp = WindowProperties()
     wp.setOrigin( 0, 0 )
     wp.setSize( frame_size.GetWidth(), frame_size.GetHeight() )
     self._win.requestProperties( wp )
开发者ID:Derfies,项目名称:panda3d-editor,代码行数:9,代码来源:wxPanda.py

示例6: bindToWindow

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
 def bindToWindow(self, windowHandle):
     wp = WindowProperties().getDefault()
     wp.setOrigin(0,0)
     wp.setSize(P3D_WIN_WIDTH, P3D_WIN_HEIGHT)
     wp.setParentWindow(windowHandle)
     base.openDefaultWindow(props=wp)
     self.wp = wp
开发者ID:nano13,项目名称:simulacron,代码行数:9,代码来源:test2.py

示例7: launch_panda_window

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
def launch_panda_window(panda_widget, size) :
    """
    Configure and create Panda window
    Connect to the gtk widget resize event
    Load a panda
    """
    props = WindowProperties().getDefault()
    props.setOrigin(0, 0)
    props.setSize(*size)
    props.setParentWindow(panda_widget.window.xid)
    base.openDefaultWindow(props=props)
    # ==
    panda_widget.connect("size_allocate", resize_panda_window)
    # ==
    panda = loader.loadModel("panda")
    panda.reparentTo(render)
    panda.setPos(0, 40, -5)

    pl = render.attachNewNode( PointLight( "redPointLight" ) )
    pl.node().setColor( Vec4( .9, .8, .8, 1 ) )
    render.setLight(pl)
    pl.node().setAttenuation( Vec3( 0, 0, 0.05 ) ) 


    slight = Spotlight('slight')
    slight.setColor(VBase4(1, 1, 1, 1))
    lens = PerspectiveLens()
    slight.setLens(lens)
    slnp = render.attachNewNode(slight)
    slnp.setPos(2, 20, 0)
    mid = PandaNode('mid')
    panda.attachNewNode(mid)
#    slnp.lookAt(mid)
    render.setLight(slnp)
开发者ID:drewp,项目名称:blockstack,代码行数:36,代码来源:pandagtk.py

示例8: OnInit

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
	def OnInit(self):
		#prepare and start the p3d-wx hybrid-engine mainloop
		self.wxevt_loop = wx.EventLoop()
		self.wxevt_old_loop = wx.EventLoop.GetActive()
		wx.EventLoop.SetActive(self.wxevt_loop)
		base.taskMgr.add(self._mainLoop, "MainLoopTask")
		
		#instantiate and assign the wx UI object
		self.win = P3dWxWindow(size=wx.Size(640, 480))
		self.SetTopWindow(self.win)
		
		#show the wx window
		self.win.Show(True)
		# is essential to let make up wx window before P3D stuff
		self._mainLoop()
		
		#bind wx events
		self.win.Bind(wx.EVT_SIZE, self.onSize)
		self.win.Bind(wx.EVT_CLOSE, self.onClose)
		self.vetoActivate=False
		self.win.Bind(wx.EVT_ACTIVATE, self.onActivate)
		
		#open the p3d window undecorated to use in the wx frame window
		wp=WindowProperties().getDefault()
		wp.setUndecorated(True)
		wp.setOpen(True)
		wp.setParentWindow(self.win.getP3DSurface())
		wp.setOrigin(0,0)
		wp.setForeground(True)
		wp.setSize(*self.win.getP3DSurfaceSize())
		print ">>>opening p3dsurface"
		assert base.openDefaultWindow(props=wp) == True
		#
		return True
开发者ID:crempp,项目名称:psg,代码行数:36,代码来源:Editor.py

示例9: resize_panda_window

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
def resize_panda_window(widget, request) :
    """ Connected to resize event of the widget Panda is draw on so that the Panda window update its size """
    props = WindowProperties().getDefault()
    props = WindowProperties(base.win.getProperties())
    props.setOrigin(0, 0)
    props.setSize(request.width, request.height)
    props.setParentWindow(widget.window.xid)
    base.win.requestProperties(props)
开发者ID:drewp,项目名称:blockstack,代码行数:10,代码来源:pandagtk.py

示例10: onSize

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
 def onSize(self, event):
     wp = WindowProperties()
     wp.setOrigin(0, 0)
     x,y = self.GetClientSize()
     wp.setSize(x,y)
     base.camLens.setAspectRatio(1.0*y/x)
     base.win.requestProperties(wp)
     event.Skip()
开发者ID:doublereedkurt,项目名称:roiders,代码行数:10,代码来源:interface.py

示例11: resizeWindow

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
 def resizeWindow(self, window_id, width, height):
     """window_id is an index of a window from base.winList."""
     window = self.windows[window_id]
     old_wp = window.getProperties()
     if old_wp.getXSize() == width and old_wp.getYSize() == height:
         return
     wp = WindowProperties()
     wp.setOrigin(0, 0)
     wp.setSize(width, height)
     window.requestProperties(wp)
开发者ID:Moqi,项目名称:panity,代码行数:12,代码来源:panda3dinstance.py

示例12: initialize

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
    def initialize(self):
        self.Update()
        wp = WindowProperties()
        wp.setOrigin(0, 0)
        wp.setSize(self.ClientSize.GetWidth(), self.ClientSize.GetHeight())
        assert self.GetHandle() != 0
        wp.setParentWindow(self.GetHandle())

        # initializing panda window
        base.windowType = "onscreen"
        props = WindowProperties.getDefault()
        props.addProperties(wp)
        self.win = base.openWindow(props = props, gsg = ViewportManager.gsg)
        if self.win:
            self.cam2d = base.makeCamera2d(self.win)
            self.cam2d.node().setCameraMask(LE_CAM_MASKS[self.name])

        if ViewportManager.gsg == None:
            ViewportManager.gsg = self.win.getGsg()
        self.cam = base.camList[-1]
        self.camera = render.attachNewNode(self.name)
        #self.camera.setName(self.name)
        #self.camera.reparentTo(render)
        self.cam.reparentTo(self.camera)
        self.camNode = self.cam.node()

        self.camNode.setCameraMask(LE_CAM_MASKS[self.name])

        self.bt = base.setupMouse(self.win, True)
        self.bt.node().setPrefix('_le_%s_'%self.name[:3])
        mw = self.bt.getParent()
        mk = mw.getParent()
        winCtrl = WindowControls(
                    self.win, mouseWatcher=mw,
                    cam=self.camera,
                    camNode = self.camNode,
                    cam2d=None,
                    mouseKeyboard =mk,
                    grid = self.grid)
        base.setupWindowControls(winCtrl)

        self.initialized = True
        if self.lens != None:      self.cam.node().setLens(self.lens)
        if self.camPos != None:    self.camera.setPos(self.camPos)
        if self.camLookAt != None: self.camera.lookAt(self.camLookAt)

        self.camLens = self.camNode.getLens()

        if self.name in ['top', 'front', 'left']:
            x = self.ClientSize.GetWidth() * 0.1
            y = self.ClientSize.GetHeight() * 0.1
            self.camLens.setFilmSize(x, y)

        self.Bind(wx.EVT_SIZE, self.onSize)
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:56,代码来源:ViewPort.py

示例13: makeGameEngine

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
	def makeGameEngine(self):
		''' Creates a new game engine based on settings in GameSettings.
			Information for this came from here
			http://panda3d.org/phpbb2/viewtopic.php?t=2848'''
		
		LOG.debug("[GXMgr] Building game engine")
		
		# Temporary
		# TODO: Fix this
		props = WindowProperties()
		props.setFullscreen(False) 
		props.setUndecorated(False) 
		#screenx = int(base.pipe.getDisplayWidth()/2) - (int(self.ScreenWidth)/2)
		#screeny = int(base.pipe.getDisplayHeight()/2) - (int(self.ScreenHeight)/2) 
		#self.TempScreenSizeRX = int(self.ScreenWidth) 
		#self.TempScreenSizeRY = int(self.ScreenHeight) 
		props.setOrigin(100,100) 
		props.setSize(1024,768) 
		base.win.requestProperties(props) 
		
		# This was the old way that no longer works - I don't know why
		## Create a new FrameBufferProperties object using our settings
		#fbProps = FrameBufferProperties()
		#fbProps.addProperties(FrameBufferProperties.getDefault())
		#fbProps.setMultisamples(GameSettings().antiAlias)
		#fbProps.setAlphaBits(GameSettings().alphaBits)
		#fbProps.setDepthBits(GameSettings().colorDepth)
		#fbProps.setColorBits(24)
		#
		## Create a WindowProperties object
		#winProps = WindowProperties( base.win.getProperties() )
		#winProps.setFullscreen(GameSettings().fullscreen)
		#winProps.setUndecorated(GameSettings().fullscreen)
		#winProps.setSize(GameSettings().xRes,GameSettings().yRes)
		#winProps.setTitle('PSG - Project Space Game: Alpha')
		#
		## Create the engine
		#base.graphicsEngine.makeOutput(base.pipe,  # GraphicsPipe
		#						'mainGameOutput',  # Name
		#						0,                 # Sort
		#						fbProps,           # FrameBufferProperties
		#						winProps,          # WindowProperties
		#						GraphicsPipe.BFRequireWindow | GraphicsPipe.BFFbPropsOptional, # Flags
		#						base.win.getGsg()) # GraphicsStateGaurdian
		##base.openMainWindow(props=winProps, gsg=base.win.getGsg(), keepCamera=1)
		#base.openMainWindow()
		#base.graphicsEngine.openWindows()
		#base.win.requestProperties(winProps)
		## The following code should proabably be moved somewhere else
		#showFPS = GameSettings().showFPS
		#base.setFrameRateMeter(showFPS)
		
开发者ID:crempp,项目名称:psg,代码行数:53,代码来源:GXMgr.py

示例14: addWindow

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
 def addWindow(self, handle=None, width=500, height=500):
     """Create a new window showing the scene. Add it to the windows list
     and return it.
     If handle is not None, it is used as parent window.
     """
     wp = WindowProperties()
     wp.setOrigin(0, 0)
     wp.setSize(width, height)
     if handle is not None:
         wp.setParentWindow(handle)
     self.base.openDefaultWindow(props=wp,
                                 type="onscreen",
                                 requireWindow=True)
     return self.base.winList[-1]
开发者ID:Moqi,项目名称:panity,代码行数:16,代码来源:panda3dinstance.py

示例15: __init__

# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setOrigin [as 别名]
    def __init__(self):
        print("began")
        self.taskMgr = taskMgr
        with open('config.json') as data_file:    
            self.conf = json.load(data_file)
        self.ServerConnection = ServerConnection()#uncomment when going live
        self.ServerConnection.connect(self.conf['host'],self.conf['port'])#uncomment when going live
        props = WindowProperties( )
        props.setTitle( 'Log In' )
        props.setFixedSize(True)
        props.setSize(1280,740)
        props.setOrigin(-2,-2)
        base.win.requestProperties( props )
        self.base = ShowBase
        self.main_theme = base.loader.loadSfx("assets/sounds/terminator_theme.ogg")
        self.main_theme.play()
        
        self.username = ""
        
        self.authConnection = AuthConnectionModel(self)#uncomment when going live
        
        self.heartbeatConnection = HeartbeatConnectionModel()#uncomment when going live
        
        self.ServerConnection.setupConnectionModel(self.heartbeatConnection)#uncomment when going live
        
        self.globalChatConnection = ChatConnectionModel(self)
        self.ServerConnection.setupConnectionModel(self.globalChatConnection)
        
        self.queueConnection = QueueConnectionModel(self)
        self.ServerConnection.setupConnectionModel(self.authConnection)#uncomment when going live
        
        self.friendConnection = FriendConnectionModel(self)
        self.ServerConnection.setupConnectionModel(self.friendConnection)
        
        
        self.taskMgr.doMethodLater(self.conf['heartbeatRate'], self.doHeartbeat, "heartbeat")#uncomment when going live
        
        self.taskMgr.doMethodLater(self.conf['heartbeatRate'], self.doHeartbeat, "heartbeat")
        
        self.screen = Login(self)#uncomment when going live
        #self.screen = Menu(self)#comment this one when you are trying to log into it like normal

        self.ServerConnection.setupConnectionModel(self.queueConnection)
        
        self.taskMgr.doMethodLater(self.conf['heartbeatRate'], self.doHeartbeat, "heartbeat")
        
        self.taskMgr.doMethodLater(1, self.doSong, "song")
        
        self.screenType = "login"
        self.screen.run()
开发者ID:genusgant,项目名称:CS594-ThrottleThunder-GameClient,代码行数:52,代码来源:newMain.py


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