本文整理汇总了Python中pandac.PandaModules.WindowProperties.setSize方法的典型用法代码示例。如果您正苦于以下问题:Python WindowProperties.setSize方法的具体用法?Python WindowProperties.setSize怎么用?Python WindowProperties.setSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandac.PandaModules.WindowProperties
的用法示例。
在下文中一共展示了WindowProperties.setSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupWindow
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [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')
示例2: bindToWindow
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [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
示例3: onSize
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [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)
示例4: OnResize
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [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 )
示例5: launch_panda_window
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [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)
示例6: resize_panda_window
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [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)
示例7: createBuffer
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [as 别名]
def createBuffer(self, name, xsize, ysize, texgroup, depthbits=1):
""" Low-level buffer creation. Not intended for public use. """
winprops = WindowProperties()
winprops.setSize(xsize, ysize)
props = FrameBufferProperties()
props.setRgbColor(1)
props.setDepthBits(depthbits)
depthtex, colortex, auxtex0, auxtex1 = texgroup
if (auxtex0 != None):
props.setAuxRgba(1)
if (auxtex1 != None):
props.setAuxRgba(2)
buffer=base.graphicsEngine.makeOutput(
self.win.getPipe(), name, -1,
props, winprops, GraphicsPipe.BFRefuseWindow | GraphicsPipe.BFResizeable,
self.win.getGsg(), self.win)
if (buffer == None):
return buffer
if (depthtex):
buffer.addRenderTexture(depthtex, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPDepth)
if (colortex):
buffer.addRenderTexture(colortex, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPColor)
if (auxtex0):
buffer.addRenderTexture(auxtex0, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPAuxRgba0)
if (auxtex1):
buffer.addRenderTexture(auxtex1, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPAuxRgba1)
buffer.setSort(self.nextsort)
buffer.disableClears()
buffer.getDisplayRegion(0).disableClears()
self.nextsort += 1
return buffer
示例8: OnInit
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [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
示例9: __init__
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [as 别名]
def __init__(self):
ShowBase.__init__(self)
########## Window configuration #########
wp = WindowProperties()
wp.setSize(1024, 860)
self.win.requestProperties(wp)
########## Gameplay settings #########
self.GAME_MODE = PLAY
self.play_mode = SPACE
self.level = 1.5
self.mode_initialized = False
######### Camera #########
self.disableMouse()
self.mainCamera = Camera(self.camera)
self.mainCamera.camObject.setHpr(0, 0, 0)
#Trigger game chain
self.loadLevel(LEVEL)
######### Events #########
self.taskMgr.add(self.gameLoop, "gameLoop", priority = 35)
self.keys = {"w" : 0, "s" : 0, "a" : 0, "d" : 0, "space" : 0}
self.accept("w", self.setKey, ["w", 1])
self.accept("w-up", self.setKey, ["w", 0])
self.accept("s", self.setKey, ["s", 1])
self.accept("s-up", self.setKey, ["s", 0])
self.accept("a", self.setKey, ["a", 1])
self.accept("a-up", self.setKey, ["a", 0])
self.accept("d", self.setKey, ["d", 1])
self.accept("d-up", self.setKey, ["d", 0])
self.accept("space", self.setKey, ["space", 1])
self.accept("space-up", self.setKey, ["space", 0])
self.accept("wheel_up", self.zoomCamera, [-1])
self.accept("wheel_down", self.zoomCamera, [1])
self.accept("escape", self.switchGameMode, [IN_GAME_MENU])
self.accept("window-event", self.handleWindowEvent)
self.accept("playerGroundRayJumping-in", self.avatar.handleCollisionEvent, ["in"])
self.accept("playerGroundRayJumping-out", self.avatar.handleCollisionEvent, ["out"])
######### GUI #########
self.gui_elements = []
示例10: bindToWindow
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [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
示例11: set
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [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
示例12: resize_panda_window
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [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)
示例13: onSize
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [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()
示例14: setFullscreen
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [as 别名]
def setFullscreen(self, settings):
"""Set the window to fullscreen or windowed mode depending on the
configuration in the settings variable"""
props = WindowProperties()
props.setFullscreen(settings.fullscreen)
props.setUndecorated(settings.fullscreen)
if settings.fullscreen:
props.setSize(settings.windowSize[0], settings.windowSize[1])
base.win.requestProperties(props)
base.taskMgr.step()
示例15: resizeWindow
# 需要导入模块: from pandac.PandaModules import WindowProperties [as 别名]
# 或者: from pandac.PandaModules.WindowProperties import setSize [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)