本文整理汇总了C++中InputState::x方法的典型用法代码示例。如果您正苦于以下问题:C++ InputState::x方法的具体用法?C++ InputState::x怎么用?C++ InputState::x使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputState
的用法示例。
在下文中一共展示了InputState::x方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleDrag
bool RotateObjectsTool::handleDrag(InputState& inputState) {
int delta = 0;
if (m_axis == Vec3f::PosZ) {
delta = -(inputState.x() - m_startX);
} else {
delta = inputState.y() - m_startY;
if (m_invert)
delta *= -1;
}
m_angle = static_cast<float>(delta) / 200.0f * Math::Pi;
Utility::Grid& grid = document().grid();
m_angle = grid.snapAngle(m_angle);
m_ignoreObjectsChange = true;
rollbackCommandGroup();
if (m_angle != 0.0f) {
Model::EditStateManager& editStateManager = document().editStateManager();
const Model::EntityList& entities = editStateManager.selectedEntities();
const Model::BrushList& brushes = editStateManager.selectedBrushes();
RotateObjectsCommand* command = RotateObjectsCommand::rotate(document(), entities, brushes, m_axis, m_angle, false, m_center, document().textureLock());
submitCommand(command);
}
m_ignoreObjectsChange = false;
return true;
}
示例2: 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;
}