本文整理汇总了C++中InputState::mouseButtons方法的典型用法代码示例。如果您正苦于以下问题:C++ InputState::mouseButtons方法的具体用法?C++ InputState::mouseButtons怎么用?C++ InputState::mouseButtons使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputState
的用法示例。
在下文中一共展示了InputState::mouseButtons方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleDrag
bool CameraTool::handleDrag(InputState& inputState) {
if (inputState.mouseButtons() == MouseButtons::MBRight) {
if (m_orbit) {
CameraOrbitEvent cameraEvent;
cameraEvent.setHAngle(inputState.deltaX() * lookSpeed(false));
cameraEvent.setVAngle(inputState.deltaY() * lookSpeed(true));
cameraEvent.setCenter(m_orbitCenter);
postEvent(cameraEvent);
} else {
CameraLookEvent cameraEvent;
cameraEvent.setHAngle(inputState.deltaX() * lookSpeed(false));
cameraEvent.setVAngle(inputState.deltaY() * lookSpeed(true));
postEvent(cameraEvent);
}
} else if (inputState.mouseButtons() == MouseButtons::MBMiddle) {
Preferences::PreferenceManager& prefs = Preferences::PreferenceManager::preferences();
bool enableAltMove = prefs.getBool(Preferences::CameraEnableAltMove);
CameraMoveEvent cameraEvent;
if (enableAltMove && inputState.modifierKeys() == ModifierKeys::MKAlt) {
cameraEvent.setRight(inputState.deltaX() * panSpeed(false));
cameraEvent.setForward(inputState.deltaY() * -moveSpeed(true));
} else {
cameraEvent.setRight(inputState.deltaX() * panSpeed(false));
cameraEvent.setUp(inputState.deltaY() * panSpeed(true));
}
postEvent(cameraEvent);
}
return true;
}
示例2: handleStartPlaneDrag
bool CreateBrushTool::handleStartPlaneDrag(InputState& inputState, Planef& plane, Vec3f& initialPoint) {
assert(m_brush == NULL);
Model::EditStateManager& editStateManager = document().editStateManager();
if (inputState.mouseButtons() != MouseButtons::MBLeft ||
inputState.modifierKeys() != ModifierKeys::MKNone ||
editStateManager.selectionMode() != Model::EditStateManager::SMNone)
return false;
Model::FaceHit* hit = static_cast<Model::FaceHit*>(inputState.pickResult().first(Model::HitType::FaceHit, true, m_filter));
if (hit != NULL) {
initialPoint = hit->hitPoint();
} else {
Renderer::Camera& camera = view().camera();
initialPoint = camera.defaultPoint(inputState.pickRay().direction);
}
plane = Planef(Vec3f::PosZ, initialPoint);
m_initialPoint = initialPoint;
updateBounds(m_initialPoint);
Preferences::PreferenceManager& prefs = Preferences::PreferenceManager::preferences();
Renderer::TextureRendererManager& textureRendererManager = document().sharedResources().textureRendererManager();
m_brushFigure = new Renderer::BrushFigure(textureRendererManager);
m_brushFigure->setFaceColor(prefs.getColor(Preferences::FaceColor));
m_brushFigure->setEdgeColor(prefs.getColor(Preferences::SelectedEdgeColor));
m_brushFigure->setOccludedEdgeColor(prefs.getColor(Preferences::OccludedSelectedEdgeColor));
m_brushFigure->setEdgeMode(Renderer::BrushFigure::EMRenderOccluded);
m_brush = new Model::Brush(document().map().worldBounds(), document().map().forceIntegerFacePoints(), m_bounds, document().mruTexture());
m_brushFigure->setBrush(*m_brush);
return true;
}
示例3: handleStartDrag
bool CameraTool::handleStartDrag(InputState& inputState) {
if (inputState.mouseButtons() == MouseButtons::MBRight) {
if (inputState.modifierKeys() == ModifierKeys::MKAlt) {
Model::Hit* hit = inputState.pickResult().first(Model::HitType::ObjectHit, true, m_filter);
if (hit != NULL)
m_orbitCenter = hit->hitPoint();
else
m_orbitCenter = inputState.camera().defaultPoint();
m_orbit = true;
return true;
} else if (inputState.modifierKeys() == ModifierKeys::MKNone) {
return true;
}
} else if (inputState.mouseButtons() == MouseButtons::MBMiddle &&
(inputState.modifierKeys() == ModifierKeys::MKNone || inputState.modifierKeys() == ModifierKeys::MKAlt)) {
return true;
}
return false;
}
示例4: handleDrag
bool CameraTool::handleDrag(InputState& inputState) {
if (inputState.mouseButtons() == MouseButtons::MBRight) {
if (m_orbit) {
CameraOrbitEvent cameraEvent;
cameraEvent.setHAngle(inputState.deltaX() * lookSpeed(false));
cameraEvent.setVAngle(inputState.deltaY() * lookSpeed(true));
cameraEvent.setCenter(m_orbitCenter);
postEvent(cameraEvent);
} else {
CameraLookEvent cameraEvent;
cameraEvent.setHAngle(inputState.deltaX() * lookSpeed(false));
cameraEvent.setVAngle(inputState.deltaY() * lookSpeed(true));
postEvent(cameraEvent);
}
} else if (inputState.mouseButtons() == MouseButtons::MBMiddle) {
CameraMoveEvent cameraEvent;
cameraEvent.setRight(inputState.deltaX() * panSpeed(false));
cameraEvent.setUp(inputState.deltaY() * panSpeed(true));
postEvent(cameraEvent);
}
return true;
}
示例5: DragInfo
RestrictedDragPolicy::DragInfo ClipToolController::MoveClipPointPart::doStartDrag(const InputState& inputState) {
if (inputState.mouseButtons() != MouseButtons::MBLeft ||
inputState.modifierKeys() != ModifierKeys::MKNone)
return DragInfo();
Vec3 initialPoint;
if (!m_callback->tool()->beginDragPoint(inputState.pickResult(), initialPoint))
return DragInfo();
DragRestricter* restricter = m_callback->createDragRestricter(inputState, initialPoint);
DragSnapper* snapper = m_callback->createDragSnapper(inputState);
return DragInfo(restricter, snapper, initialPoint);
}
示例6: handleStartDrag
bool RotateObjectsTool::handleStartDrag(InputState& inputState) {
if (inputState.mouseButtons() != MouseButtons::MBLeft ||
inputState.modifierKeys() != ModifierKeys::MKNone)
return false;
Model::EditStateManager& editStateManager = document().editStateManager();
const Model::EntityList& entities = editStateManager.selectedEntities();
const Model::BrushList& brushes = editStateManager.selectedBrushes();
if (entities.empty() && brushes.empty())
return false;
Model::RotateHandleHit* hit = static_cast<Model::RotateHandleHit*>(inputState.pickResult().first(Model::HitType::RotateHandleHit, true, view().filter()));
if (hit == NULL)
return false;
Vec3f test = hit->hitPoint() - m_rotateHandle.position();
switch (hit->hitArea()) {
case Model::RotateHandleHit::HAXAxis:
m_axis = Vec3f::PosX;
m_invert = ((test.dot(Vec3f::PosX) > 0.0f) == (test.dot(Vec3f::PosY) > 0.0f));
break;
case Model::RotateHandleHit::HAYAxis:
m_axis = Vec3f::PosY;
m_invert = ((test.dot(Vec3f::PosX) > 0.0f) != (test.dot(Vec3f::PosY) > 0.0f));
break;
case Model::RotateHandleHit::HAZAxis:
m_axis = Vec3f::PosZ;
m_invert = false;
break;
}
m_startX = inputState.x();
m_startY = inputState.y();
m_angle = 0.0f;
m_center = m_rotateHandle.position();
m_rotateHandle.lock();
beginCommandGroup(Controller::Command::makeObjectActionName(wxT("Rotate"), entities, brushes));
return true;
}