|
楼主 |
发表于 2008-12-18 14:40:09
|
显示全部楼层
South.cpp部分代码如下- bool CSouth::handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
- {
- float mouseX = ea.getX();
- float mouseY = ea.getY();
- // float mouseZ = ea.getZ();
- switch(ea.getEventType())
- {
- case(osgGA::GUIEventAdapter::KEYDOWN):
- {
- if (ea.getKey() == VK_SPACE)//' '
- {
- us.requestRedraw();
- us.requestContinuousUpdate(false);
- return true;
- }
- //q或e直线上升或下降
- if (ea.getKey() == VK_HOME || ea.getKey() == 'q' || ea.getKey() == 'Q')//home
- {
- ChangePosition(osg::Vec3 (0, 0, m_fMoveSpeed)) ;
- return true;
- }
- if (ea.getKey() == VK_END || ea.getKey() == 'e' || ea.getKey() == 'E') //end
- {
- ChangePosition(osg::Vec3 (0, 0, -m_fMoveSpeed)) ;
- return true;
- }
复制代码
[ 本帖最后由 湖面之舟 于 2008-12-26 13:35 编辑 ] |
|