From: mfranz Date: Mon, 21 Apr 2008 14:18:30 +0000 (+0000) Subject: - make online stats mode directly settable, rather than just in steps X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5588acbd42deece2464060fee88ae7f50b3f9d48;p=flightgear.git - make online stats mode directly settable, rather than just in steps - 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 --- diff --git a/src/Main/FGManipulator.cxx b/src/Main/FGManipulator.cxx index b8a6095ca..226f3685e 100644 --- a/src/Main/FGManipulator.cxx +++ b/src/Main/FGManipulator.cxx @@ -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()) { diff --git a/src/Main/FGManipulator.hxx b/src/Main/FGManipulator.hxx index b0812917a..6605f7426 100644 --- a/src/Main/FGManipulator.hxx +++ b/src/Main/FGManipulator.hxx @@ -131,6 +131,7 @@ protected: fgMouseMotionHandler mouseMotionHandler; osg::ref_ptr statsHandler; osg::ref_ptr statsEvent; + int statsType; int currentModifiers; // work-around for OSG bug int osgModifiers;