Closes #990: Add option to unlock mouse cursor when in any menu

actorid
scrawl 11 years ago
parent 17ff8165d2
commit 04f9f7af56

@ -92,6 +92,7 @@ namespace MWGui
{ {
getWidget(mOkButton, "OkButton"); getWidget(mOkButton, "OkButton");
getWidget(mBestAttackButton, "BestAttackButton"); getWidget(mBestAttackButton, "BestAttackButton");
getWidget(mGrabCursorButton, "GrabCursorButton");
getWidget(mSubtitlesButton, "SubtitlesButton"); getWidget(mSubtitlesButton, "SubtitlesButton");
getWidget(mCrosshairButton, "CrosshairButton"); getWidget(mCrosshairButton, "CrosshairButton");
getWidget(mResolutionList, "ResolutionList"); getWidget(mResolutionList, "ResolutionList");
@ -133,6 +134,7 @@ namespace MWGui
mSubtitlesButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled); mSubtitlesButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mCrosshairButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled); mCrosshairButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mBestAttackButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled); mBestAttackButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mGrabCursorButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mInvertYButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled); mInvertYButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked); mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked);
mShadersButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onShadersToggled); mShadersButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onShadersToggled);
@ -201,6 +203,7 @@ namespace MWGui
mSubtitlesButton->setCaptionWithReplacing(Settings::Manager::getBool("subtitles", "GUI") ? "#{sOn}" : "#{sOff}"); mSubtitlesButton->setCaptionWithReplacing(Settings::Manager::getBool("subtitles", "GUI") ? "#{sOn}" : "#{sOff}");
mCrosshairButton->setCaptionWithReplacing(Settings::Manager::getBool("crosshair", "HUD") ? "#{sOn}" : "#{sOff}"); mCrosshairButton->setCaptionWithReplacing(Settings::Manager::getBool("crosshair", "HUD") ? "#{sOn}" : "#{sOff}");
mBestAttackButton->setCaptionWithReplacing(Settings::Manager::getBool("best attack", "Game") ? "#{sOn}" : "#{sOff}"); mBestAttackButton->setCaptionWithReplacing(Settings::Manager::getBool("best attack", "Game") ? "#{sOn}" : "#{sOff}");
mGrabCursorButton->setCaptionWithReplacing(Settings::Manager::getBool("grab cursor", "Input") ? "#{sOn}" : "#{sOff}");
float fovVal = (Settings::Manager::getFloat("field of view", "General")-sFovMin)/(sFovMax-sFovMin); float fovVal = (Settings::Manager::getFloat("field of view", "General")-sFovMin)/(sFovMax-sFovMin);
mFOVSlider->setScrollPosition(fovVal * (mFOVSlider->getScrollRange()-1)); mFOVSlider->setScrollPosition(fovVal * (mFOVSlider->getScrollRange()-1));
@ -393,7 +396,8 @@ namespace MWGui
Settings::Manager::setBool("subtitles", "GUI", newState); Settings::Manager::setBool("subtitles", "GUI", newState);
else if (_sender == mBestAttackButton) else if (_sender == mBestAttackButton)
Settings::Manager::setBool("best attack", "Game", newState); Settings::Manager::setBool("best attack", "Game", newState);
else if (_sender == mGrabCursorButton)
Settings::Manager::setBool("grab cursor", "Input", newState);
apply(); apply();
} }
} }

@ -33,6 +33,7 @@ namespace MWGui
MyGUI::Button* mSubtitlesButton; MyGUI::Button* mSubtitlesButton;
MyGUI::Button* mCrosshairButton; MyGUI::Button* mCrosshairButton;
MyGUI::Button* mBestAttackButton; MyGUI::Button* mBestAttackButton;
MyGUI::Button* mGrabCursorButton;
// graphics // graphics
MyGUI::ListBox* mResolutionList; MyGUI::ListBox* mResolutionList;

@ -103,6 +103,7 @@ namespace MWInput
, mCameraSensitivity (Settings::Manager::getFloat("camera sensitivity", "Input")) , mCameraSensitivity (Settings::Manager::getFloat("camera sensitivity", "Input"))
, mUISensitivity (Settings::Manager::getFloat("ui sensitivity", "Input")) , mUISensitivity (Settings::Manager::getFloat("ui sensitivity", "Input"))
, mCameraYMultiplier (Settings::Manager::getFloat("camera y multiplier", "Input")) , mCameraYMultiplier (Settings::Manager::getFloat("camera y multiplier", "Input"))
, mGrabCursor (Settings::Manager::getBool("grab cursor", "Input"))
, mPreviewPOVDelay(0.f) , mPreviewPOVDelay(0.f)
, mTimeIdle(0.f) , mTimeIdle(0.f)
, mOverencumberedMessageDelay(0.f) , mOverencumberedMessageDelay(0.f)
@ -287,7 +288,7 @@ namespace MWInput
mInputManager->setMouseRelative(is_relative); mInputManager->setMouseRelative(is_relative);
//we let the mouse escape in the main menu //we let the mouse escape in the main menu
mInputManager->setGrabPointer(grab); mInputManager->setGrabPointer(grab && (mGrabCursor || is_relative));
//we switched to non-relative mode, move our cursor to where the in-game //we switched to non-relative mode, move our cursor to where the in-game
//cursor is //cursor is
@ -430,6 +431,9 @@ namespace MWInput
if (it->first == "Input" && it->second == "ui sensitivity") if (it->first == "Input" && it->second == "ui sensitivity")
mUISensitivity = Settings::Manager::getFloat("ui sensitivity", "Input"); mUISensitivity = Settings::Manager::getFloat("ui sensitivity", "Input");
if (it->first == "Input" && it->second == "grab cursor")
mGrabCursor = Settings::Manager::getBool("grab cursor", "Input");
} }
} }

@ -138,6 +138,8 @@ namespace MWInput
bool mDragDrop; bool mDragDrop;
bool mGrabCursor;
bool mInvertY; bool mInvertY;
float mCameraSensitivity; float mCameraSensitivity;

@ -65,6 +65,12 @@
</Widget> </Widget>
</Widget> </Widget>
<Widget type="HBox" skin="" position="4 260 260 24">
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="GrabCursorButton"/>
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
<Property key="Caption" value="Grab cursor"/>
</Widget>
</Widget>
</Widget> </Widget>
<Widget type="TabItem" skin="" position="4 28 360 312"> <Widget type="TabItem" skin="" position="4 28 360 312">
<Property key="Caption" value=" #{sAudio} "/> <Property key="Caption" value=" #{sAudio} "/>

@ -156,6 +156,8 @@ voice volume = 1.0
[Input] [Input]
grab cursor = true
invert y axis = false invert y axis = false
camera sensitivity = 1.0 camera sensitivity = 1.0

Loading…
Cancel
Save