mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
add size parameter to openWindow()
This commit is contained in:
parent
d90c8e3e8d
commit
69804fbb87
@ -358,7 +358,8 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
self.notify.info("Could not make graphics pipe %s." % (pipeType.getName()))
|
self.notify.info("Could not make graphics pipe %s." % (pipeType.getName()))
|
||||||
|
|
||||||
def openWindow(self, props = None, pipe = None, gsg = None,
|
def openWindow(self, props = None, pipe = None, gsg = None,
|
||||||
type = None, name = None, scene = None, aspectRatio = None):
|
type = None, name = None, scene = None,
|
||||||
|
size = None, aspectRatio = None):
|
||||||
"""
|
"""
|
||||||
Creates a window and adds it to the list of windows that are
|
Creates a window and adds it to the list of windows that are
|
||||||
to be updated every frame.
|
to be updated every frame.
|
||||||
@ -389,6 +390,12 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
if props == None:
|
if props == None:
|
||||||
props = WindowProperties.getDefault()
|
props = WindowProperties.getDefault()
|
||||||
|
|
||||||
|
if size != None:
|
||||||
|
# If we were given an explicit size, use it; otherwise,
|
||||||
|
# the size from the properties is used.
|
||||||
|
props = WindowProperties(props)
|
||||||
|
props.setSize(size[0], size[1])
|
||||||
|
|
||||||
if name == None:
|
if name == None:
|
||||||
name = 'window%s' % (self.nextWindowIndex)
|
name = 'window%s' % (self.nextWindowIndex)
|
||||||
self.nextWindowIndex += 1
|
self.nextWindowIndex += 1
|
||||||
@ -398,7 +405,7 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
win = self.graphicsEngine.makeWindow(gsg, name, 0)
|
win = self.graphicsEngine.makeWindow(gsg, name, 0)
|
||||||
elif type == 'offscreen':
|
elif type == 'offscreen':
|
||||||
win = self.graphicsEngine.makeBuffer(
|
win = self.graphicsEngine.makeBuffer(
|
||||||
gsg, name, 0, props.getXSize(), props.getYSize(), 0)
|
gsg, name, 0, props.getXSize(), props.getYSize())
|
||||||
|
|
||||||
if win == None:
|
if win == None:
|
||||||
# Couldn't create a window!
|
# Couldn't create a window!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user