mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
resize windows
This commit is contained in:
parent
cd1af67165
commit
b4f51d5ca6
@ -126,7 +126,7 @@ invoke(NPIdentifier name, const NPVariant *args, uint32_t argCount,
|
|||||||
}
|
}
|
||||||
|
|
||||||
P3D_object **p3dargs = new P3D_object *[argCount];
|
P3D_object **p3dargs = new P3D_object *[argCount];
|
||||||
for (int i = 0; i < argCount; ++i) {
|
for (unsigned int i = 0; i < argCount; ++i) {
|
||||||
p3dargs[i] = _instance->variant_to_p3dobj(&args[i]);
|
p3dargs[i] = _instance->variant_to_p3dobj(&args[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ invoke_default(const NPVariant *args, uint32_t argCount,
|
|||||||
}
|
}
|
||||||
|
|
||||||
P3D_object **p3dargs = new P3D_object *[argCount];
|
P3D_object **p3dargs = new P3D_object *[argCount];
|
||||||
for (int i = 0; i < argCount; ++i) {
|
for (unsigned int i = 0; i < argCount; ++i) {
|
||||||
p3dargs[i] = _instance->variant_to_p3dobj(&args[i]);
|
p3dargs[i] = _instance->variant_to_p3dobj(&args[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ See pack3d.py for a script that generates these p3d files.
|
|||||||
import sys
|
import sys
|
||||||
from direct.showbase import VFSImporter
|
from direct.showbase import VFSImporter
|
||||||
from direct.showbase.DirectObject import DirectObject
|
from direct.showbase.DirectObject import DirectObject
|
||||||
from pandac.PandaModules import VirtualFileSystem, Filename, Multifile, loadPrcFileData, unloadPrcFile, getModelPath, HTTPClient, Thread
|
from pandac.PandaModules import VirtualFileSystem, Filename, Multifile, loadPrcFileData, unloadPrcFile, getModelPath, HTTPClient, Thread, WindowProperties
|
||||||
from direct.stdpy import file
|
from direct.stdpy import file
|
||||||
from direct.task.TaskManagerGlobal import taskMgr
|
from direct.task.TaskManagerGlobal import taskMgr
|
||||||
from direct.showbase import AppRunnerGlobal
|
from direct.showbase import AppRunnerGlobal
|
||||||
@ -244,6 +244,7 @@ class AppRunner(DirectObject):
|
|||||||
self.startIfReady()
|
self.startIfReady()
|
||||||
|
|
||||||
def setupWindow(self, windowType, x, y, width, height, parent):
|
def setupWindow(self, windowType, x, y, width, height, parent):
|
||||||
|
print "setupWindow %s, %s, %s, %s, %s, %s" % (windowType, x, y, width, height, parent)
|
||||||
if windowType == 'hidden':
|
if windowType == 'hidden':
|
||||||
data = 'window-type none\n'
|
data = 'window-type none\n'
|
||||||
else:
|
else:
|
||||||
@ -259,7 +260,7 @@ class AppRunner(DirectObject):
|
|||||||
else:
|
else:
|
||||||
data += 'parent-window-handle 0\n'
|
data += 'parent-window-handle 0\n'
|
||||||
|
|
||||||
if x or y:
|
if x or y or windowType == 'embedded':
|
||||||
data += 'win-origin %s %s\n' % (x, y)
|
data += 'win-origin %s %s\n' % (x, y)
|
||||||
if width or height:
|
if width or height:
|
||||||
data += 'win-size %s %s\n' % (width, height)
|
data += 'win-size %s %s\n' % (width, height)
|
||||||
@ -268,8 +269,20 @@ class AppRunner(DirectObject):
|
|||||||
unloadPrcFile(self.windowPrc)
|
unloadPrcFile(self.windowPrc)
|
||||||
self.windowPrc = loadPrcFileData("setupWindow", data)
|
self.windowPrc = loadPrcFileData("setupWindow", data)
|
||||||
|
|
||||||
self.gotWindow = True
|
if self.started and base.win:
|
||||||
self.startIfReady()
|
# 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)
|
||||||
|
base.win.requestProperties(wp)
|
||||||
|
|
||||||
|
else:
|
||||||
|
# If we haven't got a window already, start 'er up.
|
||||||
|
self.gotWindow = True
|
||||||
|
self.startIfReady()
|
||||||
|
|
||||||
def setRequestFunc(self, func):
|
def setRequestFunc(self, func):
|
||||||
""" This method is called by the plugin at startup to supply a
|
""" This method is called by the plugin at startup to supply a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user