diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index dc0ed6a16b..06b38b51b0 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -185,10 +185,12 @@ class ShowBase(DirectObject.DirectObject): is closed cleanly, so that we free system resources, restore the desktop and keyboard functionality, etc. """ + # Temporary try .. except for new window code try: - # Temporary try .. except for new window code + # new window code self.graphicsEngine.removeAllWindows() except: + # old window code for win in self.winList: win.closeWindow() del self.win @@ -213,17 +215,36 @@ class ShowBase(DirectObject.DirectObject): self.pipe = makeGraphicsPipe() self.pipeList.append(self.pipe) - chanConfig = makeGraphicsWindow(self.graphicsEngine, self.pipe, self.render) + # Temporary try .. except for new window code. + try: + # old window code + chanConfig = makeGraphicsWindow(self.graphicsEngine, self.pipe, self.render) + except: + # new window code + chanString = self.config.GetString('chan-config', 'single') + chanConfig = ChanConfig(self.graphicsEngine, self.pipe, chanString, + self.render) + win = chanConfig.getWin() + # Adjust some of the window properties. + props = WindowProperties() + windowTitle = self.config.GetString("window-title", ""); + if windowTitle: + props.setTitle(windowTitle) + + win.requestProperties(props) + if self.win == None: self.win = win self.winList.append(win) + # temporary try..except to support new window code try: - # temporary try..except to support new window code + # new window code self.graphicsEngine.addWindow(win) except: + # old window code pass self.getCameras(chanConfig) diff --git a/direct/src/showbase/showBase.cxx b/direct/src/showbase/showBase.cxx index ce26c599d6..795f663062 100644 --- a/direct/src/showbase/showBase.cxx +++ b/direct/src/showbase/showBase.cxx @@ -95,36 +95,6 @@ make_graphics_pipe() { return main_pipe; } -ChanConfig -make_graphics_window(GraphicsEngine *engine, GraphicsPipe *pipe, - const NodePath &render) { - PT(GraphicsWindow) main_win; - ChanCfgOverrides override; - - std::string conf = config_showbase.GetString("chan-config", chan_config); - - // Now use ChanConfig to create the window. -#ifdef NEW_WINDOW_CODE - ChanConfig chan_config(engine, pipe, conf, render, override); - -#else // NEW_WINDOW_CODE - - override.setField(ChanCfgOverrides::Mask, - ((unsigned int)(W_DOUBLE|W_DEPTH))); - - std::string title = config_showbase.GetString("window-title", window_title); - override.setField(ChanCfgOverrides::Title, title); - - ChanConfig chan_config(pipe, conf, render, override); -#endif // NEW_WINDOW_CODE - - - main_win = chan_config.get_win(); - assert(main_win != (GraphicsWindow*)0L); - - return chan_config; -} - // Throw the "NewFrame" event in the C++ world. Some of the lerp code // depends on receiving this. void diff --git a/direct/src/showbase/showBase.h b/direct/src/showbase/showBase.h index 51d402ced1..1c9ccdb3b3 100644 --- a/direct/src/showbase/showBase.h +++ b/direct/src/showbase/showBase.h @@ -43,10 +43,6 @@ BEGIN_PUBLISH EXPCL_DIRECT DSearchPath &get_particle_path(); EXPCL_DIRECT PT(GraphicsPipe) make_graphics_pipe(); -EXPCL_DIRECT ChanConfig -make_graphics_window(GraphicsEngine *engine, GraphicsPipe *pipe, - const NodePath &render); - EXPCL_DIRECT void throw_new_frame(); EXPCL_DIRECT void take_snapshot(GraphicsWindow *win, const string &name);