]> git.mxchange.org Git - flightgear.git/commitdiff
- make online stats mode directly settable, rather than just in steps
authormfranz <mfranz>
Mon, 21 Apr 2008 14:18:30 +0000 (14:18 +0000)
committermfranz <mfranz>
Mon, 21 Apr 2008 14:18:30 +0000 (14:18 +0000)
- cosmetics: put each argument list member in a separate line, so that
  one doesn't have to break lines again whenever one inserts a new
  member

src/Main/FGManipulator.cxx
src/Main/FGManipulator.hxx

index b8a6095ca3f4a0d98600f49de751b2371302a0f4..226f3685e898bf3f6cb32c2bc8bdc061e7776180 100644 (file)
@@ -20,11 +20,21 @@ const int printStatsKey = 2;
 // idle and draw handlers.
 
 FGManipulator::FGManipulator() :
-    idleHandler(0), drawHandler(0), windowResizeHandler(0), keyHandler(0),
-    mouseClickHandler(0), mouseMotionHandler(0),
-    statsHandler(new osgViewer::StatsHandler), statsEvent(new osgGA::GUIEventAdapter),
-    currentModifiers(0), osgModifiers(0), resizable(true), mouseWarped(false),
-    scrollButtonPressed(false), useEventModifiers(false)
+    idleHandler(0),
+    drawHandler(0),
+    windowResizeHandler(0),
+    keyHandler(0),
+    mouseClickHandler(0),
+    mouseMotionHandler(0),
+    statsHandler(new osgViewer::StatsHandler),
+    statsEvent(new osgGA::GUIEventAdapter),
+    statsType(osgViewer::StatsHandler::NO_STATS),
+    currentModifiers(0),
+    osgModifiers(0),
+    resizable(true),
+    mouseWarped(false),
+    scrollButtonPressed(false),
+    useEventModifiers(false)
 {
     using namespace osgGA;
     statsHandler->setKeyEventTogglesOnScreenStats(displayStatsKey);
@@ -325,10 +335,15 @@ void FGManipulator::handleStats(osgGA::GUIActionAdapter& us)
     static SGPropertyNode_ptr display = fgGetNode("/sim/rendering/on-screen-statistics", true);
     static SGPropertyNode_ptr print = fgGetNode("/sim/rendering/print-statistics", true);
 
-    if (display->getBoolValue()) {
+    int type = display->getIntValue() % osgViewer::StatsHandler::LAST;
+    if (type != statsType) {
         statsEvent->setKey(displayStatsKey);
-        statsHandler->handle(*statsEvent, us);
-        display->setBoolValue(false);
+        do {
+            statsType = ++statsType % osgViewer::StatsHandler::LAST;
+            statsHandler->handle(*statsEvent, us);
+        } while (statsType != type);
+
+        display->setIntValue(statsType);
     }
 
     if (print->getBoolValue()) {
index b0812917aca1f345336777c603b003fb2dd29a4f..6605f742636b43c9d35d133e053aa611ac9f5dd4 100644 (file)
@@ -131,6 +131,7 @@ protected:
     fgMouseMotionHandler mouseMotionHandler;
     osg::ref_ptr<osgViewer::StatsHandler> statsHandler;
     osg::ref_ptr<osgGA::GUIEventAdapter> statsEvent;
+    int statsType;
     int currentModifiers;
     // work-around for OSG bug
     int osgModifiers;