1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 02:53:51 +00:00
This commit is contained in:
Marc Zinnschlag 2014-02-28 11:58:03 +01:00
parent 4eea2c7a86
commit ae637d6abc
7 changed files with 44 additions and 4 deletions

View file

@ -37,6 +37,9 @@ namespace CSVRender
virtual bool handleMovementKeys (int vertical, int horizontal) = 0; virtual bool handleMovementKeys (int vertical, int horizontal) = 0;
///< \return Update required? ///< \return Update required?
virtual bool handleRollKeys (int delta) = 0;
///< \return Update required?
}; };
} }

View file

@ -58,3 +58,9 @@ bool CSVRender::Navigation1st::handleMovementKeys (int vertical, int horizontal)
return true; return true;
} }
bool CSVRender::Navigation1st::handleRollKeys (int delta)
{
// we don't roll this way in 1st person mode
return false;
}

View file

@ -26,6 +26,9 @@ namespace CSVRender
virtual bool handleMovementKeys (int vertical, int horizontal); virtual bool handleMovementKeys (int vertical, int horizontal);
///< \return Update required? ///< \return Update required?
virtual bool handleRollKeys (int delta);
///< \return Update required?
}; };
} }

View file

@ -58,3 +58,9 @@ bool CSVRender::NavigationFree::handleMovementKeys (int vertical, int horizontal
return true; return true;
} }
bool CSVRender::NavigationFree::handleRollKeys (int delta)
{
mCamera->roll (Ogre::Degree (getFactor (false) * delta));
return true;
}

View file

@ -26,6 +26,9 @@ namespace CSVRender
virtual bool handleMovementKeys (int vertical, int horizontal); virtual bool handleMovementKeys (int vertical, int horizontal);
///< \return Update required? ///< \return Update required?
virtual bool handleRollKeys (int delta);
///< \return Update required?
}; };
} }

View file

@ -19,6 +19,7 @@ namespace CSVRender
, mCamera(NULL) , mCamera(NULL)
, mSceneMgr(NULL), mNavigation (0), mUpdate (false) , mSceneMgr(NULL), mNavigation (0), mUpdate (false)
, mKeyForward (false), mKeyBackward (false), mKeyLeft (false), mKeyRight (false) , mKeyForward (false), mKeyBackward (false), mKeyLeft (false), mKeyRight (false)
, mKeyRollLeft (false), mKeyRollRight (false)
, mFast (false), mDragging (false), mMod1 (false) , mFast (false), mDragging (false), mMod1 (false)
, mFastFactor (4) /// \todo make this configurable , mFastFactor (4) /// \todo make this configurable
{ {
@ -158,6 +159,8 @@ namespace CSVRender
case Qt::Key_S: mKeyBackward = true; break; case Qt::Key_S: mKeyBackward = true; break;
case Qt::Key_A: mKeyLeft = true; break; case Qt::Key_A: mKeyLeft = true; break;
case Qt::Key_D: mKeyRight = true; break; case Qt::Key_D: mKeyRight = true; break;
case Qt::Key_Q: mKeyRollLeft = true; break;
case Qt::Key_E: mKeyRollRight = true; break;
case Qt::Key_Control: mMod1 = true; break; case Qt::Key_Control: mMod1 = true; break;
case Qt::Key_Shift: case Qt::Key_Shift:
@ -181,6 +184,8 @@ namespace CSVRender
case Qt::Key_S: mKeyBackward = false; break; case Qt::Key_S: mKeyBackward = false; break;
case Qt::Key_A: mKeyLeft = false; break; case Qt::Key_A: mKeyLeft = false; break;
case Qt::Key_D: mKeyRight = false; break; case Qt::Key_D: mKeyRight = false; break;
case Qt::Key_Q: mKeyRollLeft = false; break;
case Qt::Key_E: mKeyRollRight = false; break;
case Qt::Key_Control: mMod1 = false; break; case Qt::Key_Control: mMod1 = false; break;
case Qt::Key_Shift: case Qt::Key_Shift:
@ -268,6 +273,18 @@ namespace CSVRender
if (horizontal || vertical) if (horizontal || vertical)
if (mNavigation->handleMovementKeys (vertical, horizontal)) if (mNavigation->handleMovementKeys (vertical, horizontal))
mUpdate = true; mUpdate = true;
int roll = 0;
if (mKeyRollLeft && !mKeyRollRight)
roll = 1;
else if (!mKeyRollLeft && mKeyRollRight)
roll = -1;
if (roll)
if (mNavigation->handleRollKeys (roll))
mUpdate = true;
} }
if (mUpdate) if (mUpdate)

View file

@ -57,10 +57,12 @@ namespace CSVRender
Navigation *mNavigation; Navigation *mNavigation;
bool mUpdate; bool mUpdate;
int mKeyForward; bool mKeyForward;
int mKeyBackward; bool mKeyBackward;
int mKeyLeft; bool mKeyLeft;
int mKeyRight; bool mKeyRight;
bool mKeyRollLeft;
bool mKeyRollRight;
bool mFast; bool mFast;
bool mDragging; bool mDragging;
bool mMod1; bool mMod1;