- 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:
parent
b61cc37e30
commit
5588acbd42
2 changed files with 24 additions and 8 deletions
|
@ -20,11 +20,21 @@ const int printStatsKey = 2;
|
||||||
// idle and draw handlers.
|
// idle and draw handlers.
|
||||||
|
|
||||||
FGManipulator::FGManipulator() :
|
FGManipulator::FGManipulator() :
|
||||||
idleHandler(0), drawHandler(0), windowResizeHandler(0), keyHandler(0),
|
idleHandler(0),
|
||||||
mouseClickHandler(0), mouseMotionHandler(0),
|
drawHandler(0),
|
||||||
statsHandler(new osgViewer::StatsHandler), statsEvent(new osgGA::GUIEventAdapter),
|
windowResizeHandler(0),
|
||||||
currentModifiers(0), osgModifiers(0), resizable(true), mouseWarped(false),
|
keyHandler(0),
|
||||||
scrollButtonPressed(false), useEventModifiers(false)
|
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;
|
using namespace osgGA;
|
||||||
statsHandler->setKeyEventTogglesOnScreenStats(displayStatsKey);
|
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 display = fgGetNode("/sim/rendering/on-screen-statistics", true);
|
||||||
static SGPropertyNode_ptr print = fgGetNode("/sim/rendering/print-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);
|
statsEvent->setKey(displayStatsKey);
|
||||||
statsHandler->handle(*statsEvent, us);
|
do {
|
||||||
display->setBoolValue(false);
|
statsType = ++statsType % osgViewer::StatsHandler::LAST;
|
||||||
|
statsHandler->handle(*statsEvent, us);
|
||||||
|
} while (statsType != type);
|
||||||
|
|
||||||
|
display->setIntValue(statsType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (print->getBoolValue()) {
|
if (print->getBoolValue()) {
|
||||||
|
|
|
@ -131,6 +131,7 @@ protected:
|
||||||
fgMouseMotionHandler mouseMotionHandler;
|
fgMouseMotionHandler mouseMotionHandler;
|
||||||
osg::ref_ptr<osgViewer::StatsHandler> statsHandler;
|
osg::ref_ptr<osgViewer::StatsHandler> statsHandler;
|
||||||
osg::ref_ptr<osgGA::GUIEventAdapter> statsEvent;
|
osg::ref_ptr<osgGA::GUIEventAdapter> statsEvent;
|
||||||
|
int statsType;
|
||||||
int currentModifiers;
|
int currentModifiers;
|
||||||
// work-around for OSG bug
|
// work-around for OSG bug
|
||||||
int osgModifiers;
|
int osgModifiers;
|
||||||
|
|
Loading…
Add table
Reference in a new issue