|
楼主 |
发表于 2015-2-26 11:21:10
|
显示全部楼层
程序测试return true 第二个handle也会响应呀。。。
- #include "stdafx.h"
- #include <osg/Geode>
- #include <osg/Geometry>
- #include <osgViewer/Viewer>
- #include <osgDB/ReadFile>
- #include <osg/StateSet>
- #include <osg/Camera>
- #pragma comment(lib,"OpenThreadsd.lib")
- #pragma comment(lib,"osgd.lib")
- #pragma comment(lib,"osgDBd.lib")
- #pragma comment(lib,"osgAPExd.lib")
- #pragma comment(lib,"osgGAd.lib")
- #pragma comment(lib,"osgUtild.lib")
- #pragma comment(lib,"osgTextd.lib")
- #pragma comment(lib,"osgSimd.lib")
- #pragma comment(lib,"osgViewerd.lib")
- class CPrimary : public osgGA::GUIEventHandler
- {
- public:
- bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& us){
- switch(ea.getEventType())
- {
- case osgGA::GUIEventAdapter::FRAME:
- {
- return true;
- }
- break;
- }
- return true;
- }
- };
- class CPrimary2 : public osgGA::GUIEventHandler
- {
- public:
- bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& us){
- switch(ea.getEventType())
- {
- case osgGA::GUIEventAdapter::FRAME:
- {
- //return true;
- int j =0;
- }
- break;
- }
- return false;
- }
- };
- int _tmain(int argc, _TCHAR* argv[])
- {
- osgViewer::Viewer viewer;
- viewer.setSceneData(osgDB::readNodeFile("subtile.ive"));
- osg::ref_ptr<CPrimary> pH = new CPrimary;
- osg::ref_ptr<CPrimary2> pH2 = new CPrimary2;
- viewer.addEventHandler(pH);
- viewer.addEventHandler(pH2);
- return viewer.run();
- return 0;
- }
复制代码 |
|