added settings for crosshair & subtitles

actorid
scrawl 13 years ago
parent e9b2f4ee74
commit 6ad08dfd33

@ -180,6 +180,7 @@ namespace MWBase
virtual void unsetSelectedWeapon() = 0;
virtual void showCrosshair(bool show) = 0;
virtual bool getSubtitlesEnabled() = 0;
virtual void disallowMouse() = 0;
virtual void allowMouse() = 0;

@ -85,6 +85,8 @@ namespace MWGui
WindowBase("openmw_settings_window.layout", parWindowManager)
{
getWidget(mOkButton, "OkButton");
getWidget(mSubtitlesButton, "SubtitlesButton");
getWidget(mCrosshairButton, "CrosshairButton");
getWidget(mResolutionList, "ResolutionList");
getWidget(mMenuTransparencySlider, "MenuTransparencySlider");
getWidget(mToolTipDelaySlider, "ToolTipDelaySlider");
@ -121,6 +123,8 @@ namespace MWGui
getWidget(mUISensitivitySlider, "UISensitivitySlider");
getWidget(mCameraSensitivitySlider, "CameraSensitivitySlider");
mSubtitlesButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mCrosshairButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mInvertYButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked);
mUnderwaterButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
@ -192,6 +196,9 @@ namespace MWGui
int tooltip_delay = (mToolTipDelaySlider->getScrollRange()-1) * Settings::Manager::getFloat("tooltip delay", "GUI");
mToolTipDelaySlider->setScrollPosition(tooltip_delay);
mSubtitlesButton->setCaptionWithReplacing(Settings::Manager::getBool("subtitles", "GUI") ? "#{sOn}" : "#{sOff}");
mCrosshairButton->setCaptionWithReplacing(Settings::Manager::getBool("crosshair", "HUD") ? "#{sOn}" : "#{sOff}");
float fovVal = (Settings::Manager::getFloat("field of view", "General")-sFovMin)/(sFovMax-sFovMin);
mFOVSlider->setScrollPosition(fovVal * (mFOVSlider->getScrollRange()-1));
MyGUI::TextBox* fovText;
@ -403,6 +410,10 @@ namespace MWGui
Settings::Manager::setBool("debug", "Shadows", newState);
else if (_sender == mInvertYButton)
Settings::Manager::setBool("invert y axis", "Input", newState);
else if (_sender == mCrosshairButton)
Settings::Manager::setBool("crosshair", "HUD", newState);
else if (_sender == mSubtitlesButton)
Settings::Manager::setBool("subtitles", "GUI", newState);
apply();
}

@ -30,6 +30,8 @@ namespace MWGui
MyGUI::ScrollBar* mMenuTransparencySlider;
MyGUI::ScrollBar* mToolTipDelaySlider;
MyGUI::Button* mSubtitlesButton;
MyGUI::Button* mCrosshairButton;
// graphics
MyGUI::ListBox* mResolutionList;

@ -84,6 +84,8 @@ WindowManager::WindowManager(
, mFPS(0.0f)
, mTriangleCount(0)
, mBatchCount(0)
, mCrosshairEnabled(Settings::Manager::getBool ("crosshair", "HUD"))
, mSubtitlesEnabled(Settings::Manager::getBool ("subtitles", "GUI"))
{
// Set up the GUI system
@ -644,6 +646,10 @@ void WindowManager::processChangedSettings(const Settings::CategorySettingVector
{
changeRes = true;
}
else if (it->first == "HUD" && it->second == "crosshair")
mCrosshairEnabled = Settings::Manager::getBool ("crosshair", "HUD");
else if (it->first == "GUI" && it->second == "subtitles")
mSubtitlesEnabled = Settings::Manager::getBool ("subtitles", "GUI");
}
if (changeRes)
@ -857,10 +863,15 @@ void WindowManager::notifyInputActionBound ()
void WindowManager::showCrosshair (bool show)
{
mHud->setCrosshairVisible (show);
mHud->setCrosshairVisible (show && mCrosshairEnabled);
}
void WindowManager::activateQuickKey (int index)
{
mQuickKeysMenu->activateQuickKey(index);
}
bool WindowManager::getSubtitlesEnabled ()
{
return mSubtitlesEnabled;
}

@ -161,6 +161,7 @@ namespace MWGui
virtual void unsetSelectedWeapon();
virtual void showCrosshair(bool show);
virtual bool getSubtitlesEnabled();
virtual void disallowMouse();
virtual void allowMouse();
@ -220,6 +221,9 @@ namespace MWGui
MyGUI::Widget* mInputBlocker;
bool mCrosshairEnabled;
bool mSubtitlesEnabled;
/// \todo get rid of this stuff. Move it to the respective UI element classes, if needed.
// Various stats about player as needed by window manager
ESM::Class mPlayerClass;

@ -10,6 +10,7 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "interpretercontext.hpp"
#include "ref.hpp"
@ -37,7 +38,9 @@ namespace MWScript
runtime.pop();
MWBase::Environment::get().getSoundManager()->say (ptr, file);
context.messageBox (text);
if (MWBase::Environment::get().getWindowManager ()->getSubtitlesEnabled())
context.messageBox (text);
}
};

@ -41,6 +41,18 @@
<Property key="Caption" value="#{sSlow}"/>
<Property key="TextAlign" value="Right"/>
</Widget>
<Widget type="Button" skin="MW_Button" position="4 200 34 24" align="Left Top" name="SubtitlesButton"/>
<Widget type="TextBox" skin="SandText" position="44 200 200 24" align="Left Top">
<Property key="Caption" value="#{sSubtitles}"/>
</Widget>
<Widget type="Button" skin="MW_Button" position="4 230 34 24" align="Left Top" name="CrosshairButton"/>
<Widget type="TextBox" skin="SandText" position="44 230 200 24" align="Left Top">
<Property key="Caption" value="#{sCursorOff}"/>
</Widget>
</Widget>
<Widget type="TabItem" skin="" position="4 28 360 312">
<Property key="Caption" value=" #{sAudio} "/>

@ -29,7 +29,9 @@ vsync = false
menu transparency = 0.84
# 0 - instantly, 1 - max. delay
tooltip delay = 0.2
tooltip delay = 0
subtitles = false
[General]
# Camera field of view
@ -85,6 +87,8 @@ debug = false
# 2: advanced FPS display (batches, triangles)
fps = 0
crosshair = true
[Objects]
shaders = true

Loading…
Cancel
Save