Browse Source

remove make_graphics_window

David Rose 23 years ago
parent
commit
657fa9a4c2
3 changed files with 24 additions and 37 deletions
  1. 24 3
      direct/src/showbase/ShowBase.py
  2. 0 30
      direct/src/showbase/showBase.cxx
  3. 0 4
      direct/src/showbase/showBase.h

+ 24 - 3
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)

+ 0 - 30
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 

+ 0 - 4
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);