mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
Unify cursor enabling
This commit is contained in:
parent
b33c4c920c
commit
3328775eff
4 changed files with 13 additions and 11 deletions
|
@ -48,7 +48,6 @@ namespace MWInput
|
|||
const std::string& userFile, bool userFileExists, const std::string& userControllerBindingsFile,
|
||||
const std::string& controllerBindingsFile, bool grab)
|
||||
: mGrabCursor(Settings::Manager::getBool("grab cursor", "Input"))
|
||||
, mGuiCursorEnabled(true)
|
||||
{
|
||||
mInputWrapper = new SDLUtil::InputWrapper(window, viewer, grab);
|
||||
mInputWrapper->setWindowEventCallback(MWBase::Environment::get().getWindowManager());
|
||||
|
@ -144,7 +143,7 @@ namespace MWInput
|
|||
|
||||
bool controllerMove = mControllerManager->update(dt, disableControls);
|
||||
mMouseManager->update(dt, disableControls);
|
||||
mSensorManager->update(dt, mGuiCursorEnabled);
|
||||
mSensorManager->update(dt);
|
||||
mActionManager->update(dt, controllerMove);
|
||||
}
|
||||
|
||||
|
@ -160,10 +159,10 @@ namespace MWInput
|
|||
|
||||
void InputManager::changeInputMode(bool guiMode)
|
||||
{
|
||||
mGuiCursorEnabled = guiMode;
|
||||
mControllerManager->setGuiCursorEnabled(mGuiCursorEnabled);
|
||||
mMouseManager->setGuiCursorEnabled(mGuiCursorEnabled);
|
||||
mMouseManager->setMouseLookEnabled(!mGuiCursorEnabled);
|
||||
mControllerManager->setGuiCursorEnabled(guiMode);
|
||||
mMouseManager->setGuiCursorEnabled(guiMode);
|
||||
mSensorManager->setGuiCursorEnabled(guiMode);
|
||||
mMouseManager->setMouseLookEnabled(!guiMode);
|
||||
if (guiMode)
|
||||
MWBase::Environment::get().getWindowManager()->showCrosshair(false);
|
||||
MWBase::Environment::get().getWindowManager()->setCursorVisible(guiMode && (!mControllerManager->joystickLastUsed() || mControllerManager->gamepadGuiCursorEnabled()));
|
||||
|
|
|
@ -111,8 +111,6 @@ namespace MWInput
|
|||
|
||||
bool mGrabCursor;
|
||||
|
||||
bool mGuiCursorEnabled;
|
||||
|
||||
ControlSwitch* mControlSwitch;
|
||||
|
||||
ActionManager* mActionManager;
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace MWInput
|
|||
, mGyroVAxis(GyroscopeAxis::Y)
|
||||
, mGyroInputThreshold(Settings::Manager::getFloat("gyro input threshold", "Input"))
|
||||
, mGyroscope(nullptr)
|
||||
, mGuiCursorEnabled(true)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
@ -235,7 +236,7 @@ namespace MWInput
|
|||
}
|
||||
}
|
||||
|
||||
void SensorManager::update(float dt, bool isCursorEnabled)
|
||||
void SensorManager::update(float dt)
|
||||
{
|
||||
if (mGyroXSpeed == 0.f && mGyroYSpeed == 0.f)
|
||||
return;
|
||||
|
@ -252,7 +253,7 @@ namespace MWInput
|
|||
|
||||
mGyroUpdateTimer += dt;
|
||||
|
||||
if (!isCursorEnabled)
|
||||
if (!mGuiCursorEnabled)
|
||||
{
|
||||
float rot[3];
|
||||
rot[0] = mGyroYSpeed * dt * mGyroVSensitivity * 4 * (mInvertY ? -1 : 1);
|
||||
|
|
|
@ -29,12 +29,14 @@ namespace MWInput
|
|||
|
||||
void clear();
|
||||
|
||||
void update(float dt, bool isCursorEnabled);
|
||||
void update(float dt);
|
||||
|
||||
virtual void sensorUpdated(const SDL_SensorEvent &arg);
|
||||
virtual void displayOrientationChanged();
|
||||
void processChangedSettings(const Settings::CategorySettingVector& changed);
|
||||
|
||||
void setGuiCursorEnabled(bool enabled) { mGuiCursorEnabled = enabled; }
|
||||
|
||||
private:
|
||||
enum GyroscopeAxis
|
||||
{
|
||||
|
@ -66,6 +68,8 @@ namespace MWInput
|
|||
float mGyroInputThreshold;
|
||||
|
||||
SDL_Sensor* mGyroscope;
|
||||
|
||||
bool mGuiCursorEnabled;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue