Added ability to customize the keys used to control stats
This commit is contained in:
parent
affb8f1289
commit
691e4d7b88
@ -35,6 +35,12 @@ class StatsHandler : public osgGA::GUIEventHandler
|
|||||||
LAST = 4
|
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);
|
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);
|
||||||
|
|
||||||
double getBlockMultiplier() const { return _blockMultiplier; }
|
double getBlockMultiplier() const { return _blockMultiplier; }
|
||||||
@ -53,6 +59,9 @@ class StatsHandler : public osgGA::GUIEventHandler
|
|||||||
|
|
||||||
void setUpScene(osgViewer::Viewer* viewer);
|
void setUpScene(osgViewer::Viewer* viewer);
|
||||||
|
|
||||||
|
int _keyEventTogglesOnScreenStats;
|
||||||
|
int _keyEventPrintsOutStats;
|
||||||
|
|
||||||
int _statsType;
|
int _statsType;
|
||||||
osg::ref_ptr<osg::Camera> _camera;
|
osg::ref_ptr<osg::Camera> _camera;
|
||||||
osg::ref_ptr<osg::Switch> _switch;
|
osg::ref_ptr<osg::Switch> _switch;
|
||||||
|
@ -17,6 +17,8 @@ namespace osgViewer
|
|||||||
{
|
{
|
||||||
|
|
||||||
StatsHandler::StatsHandler():
|
StatsHandler::StatsHandler():
|
||||||
|
_keyEventTogglesOnScreenStats('s'),
|
||||||
|
_keyEventPrintsOutStats('S'),
|
||||||
_statsType(NO_STATS),
|
_statsType(NO_STATS),
|
||||||
_frameRateChildNum(0),
|
_frameRateChildNum(0),
|
||||||
_viewerChildNum(0),
|
_viewerChildNum(0),
|
||||||
@ -35,7 +37,7 @@ bool StatsHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdap
|
|||||||
{
|
{
|
||||||
case(osgGA::GUIEventAdapter::KEYDOWN):
|
case(osgGA::GUIEventAdapter::KEYDOWN):
|
||||||
{
|
{
|
||||||
if (ea.getKey()=='s')
|
if (ea.getKey()==_keyEventTogglesOnScreenStats)
|
||||||
{
|
{
|
||||||
if (viewer->getStats())
|
if (viewer->getStats())
|
||||||
{
|
{
|
||||||
@ -83,7 +85,7 @@ bool StatsHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdap
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (ea.getKey()=='S')
|
if (ea.getKey()==_keyEventPrintsOutStats)
|
||||||
{
|
{
|
||||||
if (viewer->getStats())
|
if (viewer->getStats())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user