use shift key to speed up camera movement

actorid
Marc Zinnschlag 11 years ago
parent 8081c067a6
commit af50575259

@ -16,7 +16,7 @@ namespace CSVRender
, mWindow(NULL)
, mCamera(NULL)
, mSceneMgr(NULL), mNavigationMode (NavigationMode_Free), mUpdate (false)
, mKeyForward (false), mKeyBackward (false)
, mKeyForward (false), mKeyBackward (false), mFast (false)
{
setAttribute(Qt::WA_PaintOnScreen);
setAttribute(Qt::WA_NoSystemBackground);
@ -143,6 +143,7 @@ namespace CSVRender
{
case Qt::Key_W: mKeyForward = true; break;
case Qt::Key_S: mKeyBackward = true; break;
case Qt::Key_Shift: mFast = true; break;
default: QWidget::keyPressEvent (event);
}
}
@ -153,6 +154,7 @@ namespace CSVRender
{
case Qt::Key_W: mKeyForward = false; break;
case Qt::Key_S: mKeyBackward = false; break;
case Qt::Key_Shift: mFast = false; break;
default: QWidget::keyReleaseEvent (event);
}
}
@ -161,6 +163,7 @@ namespace CSVRender
{
mKeyForward = false;
mKeyBackward = false;
mFast = false;
QWidget::focusOutEvent (event);
}
@ -169,13 +172,15 @@ namespace CSVRender
{
if (mKeyForward && !mKeyBackward)
{
mCamera->move (mCamera->getDirection());
int factor = mFast ? 4 : 1;
mCamera->move (factor * mCamera->getDirection());
mUpdate = true;
}
if (!mKeyForward && mKeyBackward)
{
mCamera->move (-mCamera->getDirection());
int factor = mFast ? 4 : 1;
mCamera->move (factor * -mCamera->getDirection());
mUpdate = true;
}

@ -49,6 +49,7 @@ namespace CSVRender
bool mUpdate;
int mKeyForward;
int mKeyBackward;
bool mFast;
private slots:

Loading…
Cancel
Save