diff --git a/include/osgViewer/StatsHandler b/include/osgViewer/StatsHandler index cbd1dd8d0..5fb1d7eb2 100644 --- a/include/osgViewer/StatsHandler +++ b/include/osgViewer/StatsHandler @@ -34,6 +34,12 @@ class StatsHandler : public osgGA::GUIEventHandler SCENE_STATS = 3, LAST = 4 }; + + void setKeyEventTogglesOnScreenStats(int key) { _keyEventTogglesOnScreenStats = key; } + int getKeyEventTogglesOnScreenStats() const { return _keyEventTogglesOnScreenStats; } + + void setKeyEventPrintsOutStats(int key) { _keyEventPrintsOutStats = key; } + int getKeyEventPrintsOutStats() const { return _keyEventPrintsOutStats; } bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa); @@ -53,6 +59,9 @@ class StatsHandler : public osgGA::GUIEventHandler void setUpScene(osgViewer::Viewer* viewer); + int _keyEventTogglesOnScreenStats; + int _keyEventPrintsOutStats; + int _statsType; osg::ref_ptr _camera; osg::ref_ptr _switch; diff --git a/src/osgViewer/StatsHandler.cpp b/src/osgViewer/StatsHandler.cpp index e5a2c89ff..14792e640 100644 --- a/src/osgViewer/StatsHandler.cpp +++ b/src/osgViewer/StatsHandler.cpp @@ -17,6 +17,8 @@ namespace osgViewer { StatsHandler::StatsHandler(): + _keyEventTogglesOnScreenStats('s'), + _keyEventPrintsOutStats('S'), _statsType(NO_STATS), _frameRateChildNum(0), _viewerChildNum(0), @@ -35,7 +37,7 @@ bool StatsHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdap { case(osgGA::GUIEventAdapter::KEYDOWN): { - if (ea.getKey()=='s') + if (ea.getKey()==_keyEventTogglesOnScreenStats) { if (viewer->getStats()) { @@ -83,7 +85,7 @@ bool StatsHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdap } return true; } - if (ea.getKey()=='S') + if (ea.getKey()==_keyEventPrintsOutStats) { if (viewer->getStats()) {