1
0
Fork 0

- 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
This commit is contained in:
mfranz 2008-04-21 14:18:30 +00:00
parent b61cc37e30
commit 5588acbd42
2 changed files with 24 additions and 8 deletions

View 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);
do {
statsType = ++statsType % osgViewer::StatsHandler::LAST;
statsHandler->handle(*statsEvent, us);
display->setBoolValue(false);
} while (statsType != type);
display->setIntValue(statsType);
}
if (print->getBoolValue()) {

View 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;