]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_os.cxx
Migrate FlightGear code to use "#include SG_GL*" defined in
[flightgear.git] / src / Main / fg_os.cxx
index 6e0d96babe3926c7992cccd17232452a0696c138..067503834d100399a3e8db295ef8ae6faccfd013 100644 (file)
@@ -1,14 +1,19 @@
-// The mac puts this in a weird location (GLUT/glut.h), so the
-// configure script detects the location and defines it as a macro.
+#ifndef _MSC_VER // MSVC really needs a definition for wchar_t
+#define _WCHAR_T_DEFINED 1 // Glut needs this, or else it tries to
+                           // redefine it
+#endif
+
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
-#  include FG_GLUT_H
-#else
-#  include <GL/glut.h>
 #endif
 
+#include <simgear/compiler.h>
+
+#include SG_GLUT_H
+
 #include <plib/pu.h>
 
+#include "fg_props.hxx"
 #include "fg_os.hxx"
 
 //
@@ -138,6 +143,11 @@ void fgOSMainLoop()
     glutMainLoop();
 }
 
+void fgOSExit(int code)
+{
+    exit(code);
+}
+
 static int CurrentCursor = MOUSE_CURSOR_POINTER;
 
 int fgGetMouseCursor()
@@ -176,14 +186,23 @@ void fgRequestRedraw()
     glutPostRedisplay();
 }
 
-void fgOSOpenWindow(int w, int h, bool alpha)
+void fgOSOpenWindow(int w, int h, int bpp, bool alpha,
+                    bool stencil, bool fullscreen)
 {
     int mode = GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE;
     if(alpha) mode |= GLUT_ALPHA;
+    if(stencil) mode |= GLUT_STENCIL;
 
     glutInitDisplayMode(mode);
     glutInitWindowSize(w, h);
-    glutCreateWindow("FlightGear");
+    if(!fgGetBool("/sim/startup/game-mode")) {
+        glutCreateWindow("FlightGear");
+    } else {
+        char game_mode_str[256];
+        sprintf(game_mode_str, "width=%d height=%d bpp=%d", w, h, bpp);
+        glutGameModeString( game_mode_str );
+        glutEnterGameMode();
+    }
 
     // Register these here.  Calling them before the window is open
     // crashes.
@@ -197,4 +216,5 @@ void fgOSOpenWindow(int w, int h, bool alpha)
     glutIdleFunc(GLUTidle);
     glutDisplayFunc(GLUTdraw);
     glutReshapeFunc(GLUTreshape);
+
 }