]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/gui.cxx
Added two missing files from JSBSim.org that were missing in the last sync.
[flightgear.git] / src / GUI / gui.cxx
index 09fc0f782b258f7c72ff1bd60046180cc24d6015..2e8305ba419b6b9adf25aba261b78b8224c6a06d 100644 (file)
 
 #include <simgear/compiler.h>
 
-#ifdef HAVE_WINDOWS_H
-#  include <windows.h>
-#endif
-
 #include <string>
 
 #include <simgear/structure/exception.hxx>
@@ -53,7 +49,8 @@
 #include "gui.h"
 #include "layout.hxx"
 
-using namespace osg;
+#include <osg/GraphicsContext>
+
 using namespace flightgear;
 
 puFont guiFnt = 0;
@@ -71,7 +68,7 @@ public:
     GUIInitOperation() : GraphicsContextOperation(std::string("GUI init"))
     {
     }
-    void run(GraphicsContext* gc)
+    void run(osg::GraphicsContext* gc)
     {
         WindowSystemAdapter* wsa = WindowSystemAdapter::getWSA();
         wsa->puInitialize();
@@ -100,21 +97,21 @@ public:
     }
 };
 
-ref_ptr<GUIInitOperation> initOp;
+osg::ref_ptr<GUIInitOperation> initOp;
 }
 
-void guiStartInit()
+void guiStartInit(osg::GraphicsContext* gc)
 {
-    initOp = new GUIInitOperation;
-    WindowSystemAdapter* wsa = WindowSystemAdapter::getWSA();
-    GraphicsContext* gc = wsa->getGUIGraphicsContext();
-    gc->add(initOp.get());
+    if (gc) {
+        initOp = new GUIInitOperation;
+        gc->add(initOp.get());
+    }
 }
 
 bool guiFinishInit()
 {
     if (!initOp.valid())
-        return false;
+        return true;
     if (!initOp->isFinished())
         return false;
     initOp = 0;