mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2024-12-28 18:18:52 +00:00
parent
b5b6744321
commit
6232b4f9e8
@ -136,6 +136,7 @@ namespace MWBase
|
||||
|
||||
virtual bool isConsoleMode() const = 0;
|
||||
virtual bool isPostProcessorHudVisible() const = 0;
|
||||
virtual bool isSettingsWindowVisible() const = 0;
|
||||
virtual bool isInteractiveMessageBoxActive() const = 0;
|
||||
|
||||
virtual void toggleVisible(MWGui::GuiWindow wnd) = 0;
|
||||
@ -157,7 +158,6 @@ namespace MWBase
|
||||
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
|
||||
virtual MWGui::TradeWindow* getTradeWindow() = 0;
|
||||
virtual MWGui::PostProcessorHud* getPostProcessorHud() = 0;
|
||||
virtual MWGui::SettingsWindow* getSettingsWindow() = 0;
|
||||
|
||||
/// Make the player use an item, while updating GUI state accordingly
|
||||
virtual void useItem(const MWWorld::Ptr& item, bool force = false) = 0;
|
||||
@ -342,6 +342,7 @@ namespace MWBase
|
||||
virtual void toggleConsole() = 0;
|
||||
virtual void toggleDebugWindow() = 0;
|
||||
virtual void togglePostProcessorHud() = 0;
|
||||
virtual void toggleSettingsWindow() = 0;
|
||||
|
||||
/// Cycle to next or previous spell
|
||||
virtual void cycleSpell(bool next) = 0;
|
||||
|
@ -99,7 +99,7 @@ namespace MWGui
|
||||
}
|
||||
else if (name == "options")
|
||||
{
|
||||
winMgr->getSettingsWindow()->setVisible(true);
|
||||
winMgr->toggleSettingsWindow();
|
||||
}
|
||||
else if (name == "credits")
|
||||
winMgr->playVideo("mw_credits.bik", true);
|
||||
@ -212,6 +212,12 @@ namespace MWGui
|
||||
|
||||
bool MainMenu::exit()
|
||||
{
|
||||
if (MWBase::Environment::get().getWindowManager()->isSettingsWindowVisible())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->toggleSettingsWindow();
|
||||
return false;
|
||||
}
|
||||
|
||||
return MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_Running;
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ namespace MWGui
|
||||
}
|
||||
|
||||
SettingsWindow::SettingsWindow()
|
||||
: WindowModal("openmw_settings_window.layout")
|
||||
: WindowBase("openmw_settings_window.layout")
|
||||
, mKeyboardMode(true)
|
||||
, mCurrentPage(-1)
|
||||
{
|
||||
@ -1042,8 +1042,6 @@ namespace MWGui
|
||||
|
||||
void SettingsWindow::onOpen()
|
||||
{
|
||||
WindowModal::onOpen();
|
||||
|
||||
highlightCurrentResolution();
|
||||
updateControlsBox();
|
||||
updateLightSettings();
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class SettingsWindow : public WindowModal
|
||||
class SettingsWindow : public WindowBase
|
||||
{
|
||||
public:
|
||||
SettingsWindow();
|
||||
|
@ -914,6 +914,9 @@ namespace MWGui
|
||||
if (isConsoleMode())
|
||||
mConsole->onFrame(frameDuration);
|
||||
|
||||
if (isSettingsWindowVisible())
|
||||
mSettingsWindow->onFrame(frameDuration);
|
||||
|
||||
if (!gameRunning)
|
||||
return;
|
||||
|
||||
@ -1473,10 +1476,6 @@ namespace MWGui
|
||||
{
|
||||
return mPostProcessorHud;
|
||||
}
|
||||
MWGui::SettingsWindow* WindowManager::getSettingsWindow()
|
||||
{
|
||||
return mSettingsWindow;
|
||||
}
|
||||
|
||||
void WindowManager::useItem(const MWWorld::Ptr& item, bool bypassBeastRestrictions)
|
||||
{
|
||||
@ -1552,6 +1551,11 @@ namespace MWGui
|
||||
return mPostProcessorHud && mPostProcessorHud->isVisible();
|
||||
}
|
||||
|
||||
bool WindowManager::isSettingsWindowVisible() const
|
||||
{
|
||||
return mSettingsWindow && mSettingsWindow->isVisible();
|
||||
}
|
||||
|
||||
bool WindowManager::isInteractiveMessageBoxActive() const
|
||||
{
|
||||
return mMessageBoxManager && mMessageBoxManager->isInteractiveMessageBox();
|
||||
@ -2133,6 +2137,21 @@ namespace MWGui
|
||||
updateVisible();
|
||||
}
|
||||
|
||||
void WindowManager::toggleSettingsWindow()
|
||||
{
|
||||
bool visible = mSettingsWindow->isVisible();
|
||||
|
||||
if (!visible && !mGuiModes.empty())
|
||||
mKeyboardNavigation->saveFocus(mGuiModes.back());
|
||||
|
||||
mSettingsWindow->setVisible(!visible);
|
||||
|
||||
if (visible && !mGuiModes.empty())
|
||||
mKeyboardNavigation->restoreFocus(mGuiModes.back());
|
||||
|
||||
updateVisible();
|
||||
}
|
||||
|
||||
void WindowManager::cycleSpell(bool next)
|
||||
{
|
||||
if (!isGuiMode())
|
||||
|
@ -162,6 +162,7 @@ namespace MWGui
|
||||
|
||||
bool isConsoleMode() const override;
|
||||
bool isPostProcessorHudVisible() const override;
|
||||
bool isSettingsWindowVisible() const override;
|
||||
bool isInteractiveMessageBoxActive() const override;
|
||||
|
||||
void toggleVisible(GuiWindow wnd) override;
|
||||
@ -183,7 +184,6 @@ namespace MWGui
|
||||
MWGui::ConfirmationDialog* getConfirmationDialog() override;
|
||||
MWGui::TradeWindow* getTradeWindow() override;
|
||||
MWGui::PostProcessorHud* getPostProcessorHud() override;
|
||||
MWGui::SettingsWindow* getSettingsWindow() override;
|
||||
|
||||
/// Make the player use an item, while updating GUI state accordingly
|
||||
void useItem(const MWWorld::Ptr& item, bool bypassBeastRestrictions = false) override;
|
||||
@ -364,6 +364,7 @@ namespace MWGui
|
||||
void toggleConsole() override;
|
||||
void toggleDebugWindow() override;
|
||||
void togglePostProcessorHud() override;
|
||||
void toggleSettingsWindow() override;
|
||||
|
||||
/// Cycle to next or previous spell
|
||||
void cycleSpell(bool next) override;
|
||||
|
@ -166,9 +166,7 @@ namespace MWInput
|
||||
|
||||
// Don't trigger any mouse bindings while in settings menu, otherwise rebinding controls becomes impossible
|
||||
// Also do not trigger bindings when input controls are disabled, e.g. during save loading
|
||||
const MWGui::SettingsWindow* settingsWindow
|
||||
= MWBase::Environment::get().getWindowManager()->getSettingsWindow();
|
||||
if ((!settingsWindow || !settingsWindow->isVisible()) && !input->controlsDisabled())
|
||||
if (!MWBase::Environment::get().getWindowManager()->isSettingsWindowVisible() && !input->controlsDisabled())
|
||||
{
|
||||
mBindingsManager->mousePressed(arg, id);
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
<Layer name="DrowningBar" overlapped="false" pick="false"/>
|
||||
<Layer name="MainMenuBackground" overlapped="true" pick="true"/>
|
||||
<Layer name="MainMenu" overlapped="true" pick="true"/>
|
||||
<Layer name="Settings" overlapped="true" pick="true"/>
|
||||
<Layer name="LoadingScreenBackground" overlapped="false" pick="true"/>
|
||||
<Layer name="LoadingScreen" overlapped="false" pick="true"/>
|
||||
<Layer name="Debug" overlapped="true" pick="true"/>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MyGUI type="Layout" version="3.2.0">
|
||||
<Widget type="Window" skin="MW_Window" position="0 0 400 485" layer="MainMenu" name="_Main">
|
||||
<Widget type="Window" skin="MW_Window" position="0 0 400 485" layer="Settings" name="_Main">
|
||||
<Property key="MinSize" value="640 490"/>
|
||||
<Widget type="TabControl" skin="TabControl" position="8 8 368 405" align="Stretch" name="SettingsTab">
|
||||
<Property key="ButtonAutoWidth" value="true"/>
|
||||
|
Loading…
Reference in New Issue
Block a user