Andy Ross wrote:
[about making the panel hot spots visible]
Try the attached patch, which predicates the boxes on the
/sim/panel-hotspots property.
That is excellent! So simple, and in conjunction with David's recent zoom in/out/normal (+/-/=) bindings, it immediately makes clear what's going on with the hot spots, and shows up the existing mistakes. Everyone designing clickable instruments will benefit from this, so I think your patch should go into CVS permanently.

I was just trying to sort some hot spots out by editing the numbers, when I remembered that you'd just sent this patch. What a powerful tool visualisation is!

- Julian
Index: panel.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Cockpit/panel.hxx,v
retrieving revision 1.2
diff -u -r1.2 panel.hxx
--- panel.hxx   29 Oct 2002 19:44:03 -0000      1.2
+++ panel.hxx   5 Nov 2002 21:38:59 -0000
@@ -370,6 +370,7 @@
   virtual ~FGPanelInstrument ();
 
   virtual void draw () = 0;
+  virtual void drawHotspots();
 
   virtual void setPosition(int x, int y);
   virtual void setSize(int w, int h);
Index: panel.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Cockpit/panel.cxx,v
retrieving revision 1.3
diff -u -r1.3 panel.cxx
--- panel.cxx   29 Oct 2002 19:44:03 -0000      1.3
+++ panel.cxx   5 Nov 2002 21:38:59 -0000
@@ -436,6 +436,21 @@
     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);
@@ -647,6 +662,25 @@
        it++) {
     delete *it;
     *it = 0;
+  }
+}
+
+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();
   }
 }
 


Reply via email to