I wrote:
> Jim Wilson wrote:
> > How hard would it be to have a property that toggles hotspot
> > visibility? It'd be nice to be able to turn it on and have yellow
> > rectangles show up on the hotspots...
>
> That's not a bad idea.
It's actually an astoundingly good idea, and implementable over lunch
to boot. :)
Try the attached patch, which predicates the boxes on the
/sim/panel-hotspots property. I mapped a toggle event on this to a
spare joystick button, and had fun. :)
Andy
--
Andrew J. Ross NextBus Information Systems
Senior Software Engineer Emeryville, CA
[EMAIL PROTECTED] http://www.nextbus.com
"Men go crazy in conflagrations. They only get better one by one."
- Sting (misquoted)
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();
}
}