]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/panel.cxx
Andy Ross:
[flightgear.git] / src / Cockpit / panel.cxx
index 19a2672028b3fbdbda227ef6810907a74194cb89..130b1315c4ca2197af5bc53788214c732aa4ac5d 100644 (file)
@@ -370,7 +370,7 @@ FGPanel::draw()
   // of an existing polygon.  Use an offset to prevent z-fighting.  In
   // 2D mode, this is a no-op.
   glEnable(GL_POLYGON_OFFSET_FILL);
-  glPolygonOffset(0, -POFF_UNITS);
+  glPolygonOffset(-1, -POFF_UNITS);
 
   // save some state
   glPushAttrib( GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT | GL_LIGHTING_BIT
@@ -436,6 +436,21 @@ FGPanel::draw()
     glPopMatrix();
   }
 
+  // Draw yellow "hotspots" if directed to.  This is a panel authoring
+  // feature; not intended to be high performance or to look good.
+  if(fgGetBool("/sim/panel-hotspots")) {
+    glPushAttrib(GL_ALL_ATTRIB_BITS);
+    glDisable(GL_DEPTH_TEST);
+    glDisable(GL_TEXTURE_2D);
+    glColor3f(1, 1, 0);
+    
+    for(int i=0; i<_instruments.size(); i++)
+      _instruments[i]->drawHotspots();
+
+    glPopAttrib();
+  }
+
+
   // restore some original state
   glPopAttrib();
   glPolygonOffset(0, 0);
@@ -650,6 +665,25 @@ FGPanelInstrument::~FGPanelInstrument ()
   }
 }
 
+void
+FGPanelInstrument::drawHotspots()
+{
+  for(int i=0; i<_actions.size(); i++) {
+    FGPanelAction* a = _actions[i];
+    float x1 = getXPos() + a->getX();
+    float x2 = x1 + a->getWidth();
+    float y1 = getYPos() + a->getY();
+    float y2 = y1 + a->getHeight();
+
+    glBegin(GL_LINE_LOOP);
+    glVertex2f(x1, y1);
+    glVertex2f(x1, y2);
+    glVertex2f(x2, y2);
+    glVertex2f(x2, y1);
+    glEnd();
+  }
+}
+
 void
 FGPanelInstrument::setPosition (int x, int y)
 {