mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 12:12:10 -04:00
Moved multiwindow support from branch to trunk
This commit is contained in:
parent
9f512d07e1
commit
8e71577259
@ -110,6 +110,7 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
self.win = None
|
self.win = None
|
||||||
self.frameRateMeter = None
|
self.frameRateMeter = None
|
||||||
self.winList = []
|
self.winList = []
|
||||||
|
self.winControls = []
|
||||||
self.mainWinMinimized = 0
|
self.mainWinMinimized = 0
|
||||||
self.pipe = None
|
self.pipe = None
|
||||||
self.pipeList = []
|
self.pipeList = []
|
||||||
@ -254,6 +255,9 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
import Transitions
|
import Transitions
|
||||||
self.transitions = Transitions.Transitions(self.loader)
|
self.transitions = Transitions.Transitions(self.loader)
|
||||||
|
|
||||||
|
# Setup the window controls - handy for multiwindow applications
|
||||||
|
self.setupWindowControls()
|
||||||
|
|
||||||
# Start Tk and DIRECT if specified by Config.prc
|
# Start Tk and DIRECT if specified by Config.prc
|
||||||
fTk = self.config.GetBool('want-tk', 0)
|
fTk = self.config.GetBool('want-tk', 0)
|
||||||
# Start DIRECT if specified in Config.prc or in cluster mode
|
# Start DIRECT if specified in Config.prc or in cluster mode
|
||||||
@ -592,6 +596,13 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
self.frameRateMeter.clearWindow()
|
self.frameRateMeter.clearWindow()
|
||||||
self.frameRateMeter = None
|
self.frameRateMeter = None
|
||||||
|
|
||||||
|
def setupWindowControls(self):
|
||||||
|
if not self.winControls:
|
||||||
|
winCtrl = WindowControls(self.win, mouseWatcher=self.mouseWatcher,
|
||||||
|
cam=self.camera, cam2d=self.camera2d,
|
||||||
|
mouseKeyboard = self.dataRoot.find("**/*"))
|
||||||
|
self.winControls.append(winCtrl)
|
||||||
|
|
||||||
|
|
||||||
def setupRender(self):
|
def setupRender(self):
|
||||||
"""
|
"""
|
||||||
@ -1612,3 +1623,22 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
self.taskMgr.run()
|
self.taskMgr.run()
|
||||||
|
|
||||||
|
|
||||||
|
# A class to encapsulate information necessary for multiwindow support.
|
||||||
|
class WindowControls:
|
||||||
|
def __init__(self, win, cam=None, cam2d=None, mouseWatcher=None, mouseKeyboard=None, closeCmd=lambda : 0):
|
||||||
|
self.win = win
|
||||||
|
self.camera = cam
|
||||||
|
self.camera2d = cam2d
|
||||||
|
self.mouseWatcher = mouseWatcher
|
||||||
|
self.mouseKeyboard = mouseKeyboard
|
||||||
|
self.closeCommand = closeCmd
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
s = "window = " + str(self.win) + "\n"
|
||||||
|
s += "camera = " + str(self.camera) + "\n"
|
||||||
|
s += "camera2d = " + str(self.camera2d) + "\n"
|
||||||
|
s += "mouseWatcher = " + str(self.mouseWatcher) + "\n"
|
||||||
|
s += "mouseAndKeyboard = " + str(self.mouseKeyboard) + "\n"
|
||||||
|
return s
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user