]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/panel.cxx
Make adf volume and adf on/off seperate properties.
[flightgear.git] / src / Cockpit / panel.cxx
index a7cbecb1a4192126b0a32205a3165fccc331feb0..0199dd1789e1911c3409aa369f748985cb12efba 100644 (file)
 // my hardware/driver requires many more.
 #define POFF_UNITS 40
 
-#if defined( NONE ) && defined( _MSC_VER )
-#  pragma message( "A sloppy coder has defined NONE as a macro!!!" )
-#  undef NONE
-#elif defined( NONE )
-#  pragma warn A sloppy coder has defined NONE as a macro!!!
-#  undef NONE
-#endif
-
 \f
 ////////////////////////////////////////////////////////////////////////
 // Local functions.
@@ -280,6 +272,7 @@ FGPanel::update (double dt)
     _x_offset = fgGetInt("/sim/panel/x-offset");
     _y_offset = fgGetInt("/sim/panel/y-offset");
     _jitter = fgGetFloat("/sim/panel/jitter");
+    _flipx = fgGetBool("/sim/panel/flip-x");
 
                                // Do nothing if the panel isn't visible.
     if ( !fgPanelVisible() ) {
@@ -338,8 +331,11 @@ FGPanel::update (GLfloat winx, GLfloat winw, GLfloat winy, GLfloat winh)
   glMatrixMode(GL_PROJECTION);
   glPushMatrix();
   glLoadIdentity();
-  gluOrtho2D(winx, winx + winw, winy, winy + winh); /* right side up */
-  // gluOrtho2D(winx + winw, winx, winy + winh, winy); /* up side down */
+  if ( _flipx ) {
+    gluOrtho2D(winx + winw, winx, winy + winh, winy); /* up side down */
+  } else {
+    gluOrtho2D(winx, winx + winw, winy, winy + winh); /* right side up */
+  }
   
   glMatrixMode(GL_MODELVIEW);
   glPushMatrix();
@@ -367,6 +363,10 @@ FGPanel::draw()
   glEnable(GL_POLYGON_OFFSET_FILL);
   glPolygonOffset(0, -POFF_UNITS);
 
+  // save some state
+  glPushAttrib( GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT | GL_LIGHTING_BIT
+                | GL_TEXTURE_BIT | GL_PIXEL_MODE_BIT );
+
   // Draw the background
   glEnable(GL_TEXTURE_2D);
   glDisable(GL_LIGHTING);
@@ -425,6 +425,9 @@ FGPanel::draw()
     glPopMatrix();
   }
 
+  // restore some original state
+  glPopAttrib();
+  glPolygonOffset(0, 0);
   glDisable(GL_POLYGON_OFFSET_FILL);
 }