bool mouseMoved(const OIS::MouseEvent &arg) { mCameraAngleH -= Ogre::Degree((Ogre::Real)arg.state.X.rel); mCameraAngleV -= Ogre::Degree((Ogre::Real)arg.state.Y.rel); mCamera->setOrientation(Ogre::Quaternion::IDENTITY); mCamera->yaw(mCameraAngleH*0.1); mCamera->pitch(mCameraAngleV*0.1); mGUI->injectMouseMove(arg); return true; }
void GraphicsImpl::handleMouseEvents(const DataContainer& data) { InputMouseEvent ev = boost::any_cast<InputMouseEvent>(data.data); static bool mouseButtonPressed = false; gui->injectMouseMove(ev.mouseX, ev.mouseY, 0); camera->yaw(Ogre::Degree(-ev.mouseDeltaX * 0.13)); camera->pitch(Ogre::Degree(-ev.mouseDeltaY * 0.13)); MyGUI::MouseButton id; if (ev.type == BUTTON_MOUSE_LEFT) { id = MyGUI::MouseButton::Left; } else if (ev.type == BUTTON_MOUSE_RIGHT) { id = MyGUI::MouseButton::Right; } else { id = MyGUI::MouseButton::Middle; } if (ev.action == BUTTON_PRESSED) { mouseButtonPressed = true; gui->injectMousePress(ev.mouseX, ev.mouseY, id); } else { mouseButtonPressed = false; gui->injectMouseRelease(ev.mouseX, ev.mouseY, id); } }