UI cursor & camera sensitivity sliders

actorid
scrawl 13 years ago
parent c7b8787c32
commit 67577c6192

@ -118,6 +118,8 @@ namespace MWGui
getWidget(mControlsBox, "ControlsBox");
getWidget(mResetControlsButton, "ResetControlsButton");
getWidget(mInvertYButton, "InvertYButton");
getWidget(mUISensitivitySlider, "UISensitivitySlider");
getWidget(mCameraSensitivitySlider, "CameraSensitivitySlider");
mInvertYButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked);
@ -226,6 +228,14 @@ namespace MWGui
mMiscShadows->setCaptionWithReplacing(Settings::Manager::getBool("misc shadows", "Shadows") ? "#{sOn}" : "#{sOff}");
mShadowsDebug->setCaptionWithReplacing(Settings::Manager::getBool("debug", "Shadows") ? "#{sOn}" : "#{sOff}");
float cameraSens = (Settings::Manager::getFloat("camera sensitivity", "Input")-0.2)/(5.0-0.2);
mCameraSensitivitySlider->setScrollPosition (cameraSens * (mCameraSensitivitySlider->getScrollRange()-1));
float uiSens = (Settings::Manager::getFloat("ui sensitivity", "Input")-0.2)/(5.0-0.2);
mUISensitivitySlider->setScrollPosition (uiSens * (mUISensitivitySlider->getScrollRange()-1));
mCameraSensitivitySlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
mUISensitivitySlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
mInvertYButton->setCaptionWithReplacing(Settings::Manager::getBool("invert y axis", "Input") ? "#{sOn}" : "#{sOff}");
std::string shaders;
@ -510,6 +520,10 @@ namespace MWGui
Settings::Manager::setFloat("footsteps volume", "Sound", val);
else if (scroller == mMusicVolumeSlider)
Settings::Manager::setFloat("music volume", "Sound", val);
else if (scroller == mUISensitivitySlider)
Settings::Manager::setFloat("ui sensitivity", "Input", (1-val) * 0.2 + val * 5.f);
else if (scroller == mCameraSensitivitySlider)
Settings::Manager::setFloat("camera sensitivity", "Input", (1-val) * 0.2 + val * 5.f);
apply();
}

@ -68,6 +68,8 @@ namespace MWGui
MyGUI::ScrollView* mControlsBox;
MyGUI::Button* mResetControlsButton;
MyGUI::Button* mInvertYButton;
MyGUI::ScrollBar* mUISensitivitySlider;
MyGUI::ScrollBar* mCameraSensitivitySlider;
void onOkButtonClicked(MyGUI::Widget* _sender);
void onFpsToggled(MyGUI::Widget* _sender);

@ -41,6 +41,10 @@ namespace MWInput
, mDragDrop(false)
, mGuiCursorEnabled(false)
, mInvertY (Settings::Manager::getBool("invert y axis", "Input"))
, mCameraSensitivity (Settings::Manager::getFloat("camera sensitivity", "Input"))
, mUISensitivity (Settings::Manager::getFloat("ui sensitivity", "Input"))
, mCameraYMultiplier (Settings::Manager::getFloat("camera y multiplier", "Input"))
, mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input"))
{
Ogre::RenderWindow* window = ogre.getWindow ();
size_t windowHnd;
@ -284,6 +288,13 @@ namespace MWInput
if (it->first == "Input" && it->second == "invert y axis")
mInvertY = Settings::Manager::getBool("invert y axis", "Input");
if (it->first == "Input" && it->second == "camera sensitivity")
mCameraSensitivity = Settings::Manager::getFloat("camera sensitivity", "Input");
if (it->first == "Input" && it->second == "ui sensitivity")
mUISensitivity = Settings::Manager::getFloat("ui sensitivity", "Input");
}
if (changeRes)
@ -367,8 +378,8 @@ namespace MWInput
// We keep track of our own mouse position, so that moving the mouse while in
// game mode does not move the position of the GUI cursor
mMouseX += arg.state.X.rel;
mMouseY += arg.state.Y.rel;
mMouseX += arg.state.X.rel * mUISensitivity;
mMouseY += arg.state.Y.rel * mUISensitivity * mUIYMultiplier;
mMouseX = std::max(0, std::min(mMouseX, viewSize.width));
mMouseY = std::max(0, std::min(mMouseY, viewSize.height));
@ -377,8 +388,8 @@ namespace MWInput
if (mMouseLookEnabled)
{
float x = arg.state.X.rel * 0.2;
float y = arg.state.Y.rel * 0.2 * (mInvertY ? -1 : 1);
float x = arg.state.X.rel * mCameraSensitivity * 0.2;
float y = arg.state.Y.rel * mCameraSensitivity * 0.2 * (mInvertY ? -1 : 1) * mUIYMultiplier;
MWBase::World *world = MWBase::Environment::get().getWorld();
world->rotateObject(world->getPlayer().getPlayer(), -y, 0.f, x, true);
@ -578,9 +589,6 @@ namespace MWInput
descriptions[A_Rest] = "sRestKey";
descriptions[A_Inventory] = "sInventory";
if (action == A_GameMenu)
return "Menu"; // not configurable in morrowind so no GMST
if (descriptions[action] == "")
return ""; // not configurable
@ -619,7 +627,6 @@ namespace MWInput
ret.push_back(A_Journal);
ret.push_back(A_Rest);
ret.push_back(A_Console);
ret.push_back(A_GameMenu);
return ret;
}

@ -135,6 +135,11 @@ namespace MWInput
bool mInvertY;
float mCameraSensitivity;
float mUISensitivity;
float mCameraYMultiplier;
float mUIYMultiplier;
bool mMouseLookEnabled;
bool mGuiCursorEnabled;

@ -83,19 +83,53 @@
<Widget type="TabItem" skin="" position="4 28 360 312">
<Property key="Caption" value=" #{sControls} "/>
<Widget type="Widget" skin="MW_Box" position="8 8 344 180">
<Widget type="ScrollView" skin="MW_ScrollView" name="ControlsBox" position="4 4 336 172"/>
<Widget type="Widget" skin="MW_Box" position="8 8 344 150">
<Widget type="ScrollView" skin="MW_ScrollView" name="ControlsBox" position="4 4 336 142"/>
</Widget>
<Widget type="Button" skin="MW_Button" name="ResetControlsButton" position="4 192 100 24">
<Widget type="Button" skin="MW_Button" name="ResetControlsButton" position="4 162 100 24">
<Property key="Caption" value="#{sControlsMenu1}"/>
</Widget>
<Widget type="Button" skin="MW_Button" name="InvertYButton" position="4 222 32 24"/>
<Widget type="TextBox" skin="SandText" position="40 222 200 24">
<Widget type="Button" skin="MW_Button" name="InvertYButton" position="4 192 32 24"/>
<Widget type="TextBox" skin="SandText" position="40 192 200 24">
<Property key="Caption" value="#{sMouseFlip}"/>
</Widget>
<Widget type="TextBox" skin="NormalText" position="4 228 160 18" align="Left Top">
<Property key="Caption" value="UI cursor sensitivity"/>
</Widget>
<Widget type="ScrollBar" skin="MW_HSlider" position="4 252 160 18" align="Left Top" name="UISensitivitySlider">
<Property key="Range" value="1000000"/>
</Widget>
<Widget type="TextBox" skin="SandText" position="4 276 160 18" align="Left Top">
<Property key="Caption" value="#{sLow}"/>
<Property key="TextAlign" value="Left"/>
</Widget>
<Widget type="TextBox" skin="SandText" position="4 276 160 18" align="Left Top">
<Property key="Caption" value="#{sHigh}"/>
<Property key="TextAlign" value="Right"/>
</Widget>
<Widget type="TextBox" skin="NormalText" position="180 228 160 18" align="Left Top">
<Property key="Caption" value="Camera sensitivity"/>
</Widget>
<Widget type="ScrollBar" skin="MW_HSlider" position="180 252 160 18" align="Left Top" name="CameraSensitivitySlider">
<Property key="Range" value="1000000"/>
</Widget>
<Widget type="TextBox" skin="SandText" position="180 276 160 18" align="Left Top">
<Property key="Caption" value="#{sLow}"/>
<Property key="TextAlign" value="Left"/>
</Widget>
<Widget type="TextBox" skin="SandText" position="180 276 160 18" align="Left Top">
<Property key="Caption" value="#{sHigh}"/>
<Property key="TextAlign" value="Right"/>
</Widget>
</Widget>
<Widget type="TabItem" skin="" position="4 28 360 312">
<Property key="Caption" value=" #{sVideo} "/>
@ -135,11 +169,11 @@
<Property key="Range" value="1000000"/>
</Widget>
<Widget type="TextBox" skin="SandText" position="4 246 329 18" align="Left Top">
<Property key="Caption" value="Low"/>
<Property key="Caption" value="#{sLow}"/>
<Property key="TextAlign" value="Left"/>
</Widget>
<Widget type="TextBox" skin="SandText" position="4 246 329 18" align="Left Top">
<Property key="Caption" value="High"/>
<Property key="Caption" value="#{sHigh}"/>
<Property key="TextAlign" value="Right"/>
</Widget>
</Widget>

@ -149,3 +149,11 @@ voice volume = 1.0
[Input]
invert y axis = false
camera sensitivity = 1.0
ui sensitivity = 1.0
camera y multiplier = 1.0
ui y multiplier = 1.0

Loading…
Cancel
Save