mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-02 13:06:39 +00:00
Merge branch 'borderless_fullscreen' into 'master'
Windowed fullscreen mode (#6700) Closes #6700 See merge request OpenMW/openmw!1825
This commit is contained in:
commit
0145819bc9
13 changed files with 164 additions and 89 deletions
|
@ -157,6 +157,7 @@
|
||||||
Feature #6600: Support NiSortAdjustNode
|
Feature #6600: Support NiSortAdjustNode
|
||||||
Feature #6684: Support NiFltAnimationNode
|
Feature #6684: Support NiFltAnimationNode
|
||||||
Feature #6699: Ignored flag
|
Feature #6699: Ignored flag
|
||||||
|
Feature #6700: Support windowed fullscreen
|
||||||
Feature #6706: Save the size of the Options window
|
Feature #6706: Save the size of the Options window
|
||||||
Feature #6721: [OpenMW-CS] Add option to open records in new window
|
Feature #6721: [OpenMW-CS] Add option to open records in new window
|
||||||
Task #6201: Remove the "Note: No relevant classes found. No output generated" warnings
|
Task #6201: Remove the "Note: No relevant classes found. No output generated" warnings
|
||||||
|
|
|
@ -42,7 +42,7 @@ Launcher::GraphicsPage::GraphicsPage(QWidget *parent)
|
||||||
customWidthSpinBox->setMaximum(res.width());
|
customWidthSpinBox->setMaximum(res.width());
|
||||||
customHeightSpinBox->setMaximum(res.height());
|
customHeightSpinBox->setMaximum(res.height());
|
||||||
|
|
||||||
connect(fullScreenCheckBox, SIGNAL(stateChanged(int)), this, SLOT(slotFullScreenChanged(int)));
|
connect(windowModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotFullScreenChanged(int)));
|
||||||
connect(standardRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotStandardToggled(bool)));
|
connect(standardRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotStandardToggled(bool)));
|
||||||
connect(screenComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(screenChanged(int)));
|
connect(screenComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(screenChanged(int)));
|
||||||
connect(framerateLimitCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotFramerateLimitToggled(bool)));
|
connect(framerateLimitCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotFramerateLimitToggled(bool)));
|
||||||
|
@ -94,8 +94,10 @@ bool Launcher::GraphicsPage::loadSettings()
|
||||||
if (Settings::Manager::getBool("vsync", "Video"))
|
if (Settings::Manager::getBool("vsync", "Video"))
|
||||||
vSyncCheckBox->setCheckState(Qt::Checked);
|
vSyncCheckBox->setCheckState(Qt::Checked);
|
||||||
|
|
||||||
if (Settings::Manager::getBool("fullscreen", "Video"))
|
size_t windowMode = static_cast<size_t>(Settings::Manager::getInt("window mode", "Video"));
|
||||||
fullScreenCheckBox->setCheckState(Qt::Checked);
|
if (windowMode > static_cast<size_t>(Settings::WindowMode::Windowed))
|
||||||
|
windowMode = 0;
|
||||||
|
windowModeComboBox->setCurrentIndex(windowMode);
|
||||||
|
|
||||||
if (Settings::Manager::getBool("window border", "Video"))
|
if (Settings::Manager::getBool("window border", "Video"))
|
||||||
windowBorderCheckBox->setCheckState(Qt::Checked);
|
windowBorderCheckBox->setCheckState(Qt::Checked);
|
||||||
|
@ -183,9 +185,9 @@ void Launcher::GraphicsPage::saveSettings()
|
||||||
if (cVSync != Settings::Manager::getBool("vsync", "Video"))
|
if (cVSync != Settings::Manager::getBool("vsync", "Video"))
|
||||||
Settings::Manager::setBool("vsync", "Video", cVSync);
|
Settings::Manager::setBool("vsync", "Video", cVSync);
|
||||||
|
|
||||||
bool cFullScreen = fullScreenCheckBox->checkState();
|
int cWindowMode = windowModeComboBox->currentIndex();
|
||||||
if (cFullScreen != Settings::Manager::getBool("fullscreen", "Video"))
|
if (cWindowMode != Settings::Manager::getInt("window mode", "Video"))
|
||||||
Settings::Manager::setBool("fullscreen", "Video", cFullScreen);
|
Settings::Manager::setInt("window mode", "Video", cWindowMode);
|
||||||
|
|
||||||
bool cWindowBorder = windowBorderCheckBox->checkState();
|
bool cWindowBorder = windowBorderCheckBox->checkState();
|
||||||
if (cWindowBorder != Settings::Manager::getBool("window border", "Video"))
|
if (cWindowBorder != Settings::Manager::getBool("window border", "Video"))
|
||||||
|
@ -355,9 +357,9 @@ void Launcher::GraphicsPage::screenChanged(int screen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launcher::GraphicsPage::slotFullScreenChanged(int state)
|
void Launcher::GraphicsPage::slotFullScreenChanged(int mode)
|
||||||
{
|
{
|
||||||
if (state == Qt::Checked) {
|
if (mode == static_cast<int>(Settings::WindowMode::Fullscreen) || mode == static_cast<int>(Settings::WindowMode::WindowedFullscreen)) {
|
||||||
standardRadioButton->toggle();
|
standardRadioButton->toggle();
|
||||||
customRadioButton->setEnabled(false);
|
customRadioButton->setEnabled(false);
|
||||||
customWidthSpinBox->setEnabled(false);
|
customWidthSpinBox->setEnabled(false);
|
||||||
|
|
|
@ -554,7 +554,7 @@ void OMW::Engine::createWindow(Settings::Manager& settings)
|
||||||
int screen = settings.getInt("screen", "Video");
|
int screen = settings.getInt("screen", "Video");
|
||||||
int width = settings.getInt("resolution x", "Video");
|
int width = settings.getInt("resolution x", "Video");
|
||||||
int height = settings.getInt("resolution y", "Video");
|
int height = settings.getInt("resolution y", "Video");
|
||||||
bool fullscreen = settings.getBool("fullscreen", "Video");
|
Settings::WindowMode windowMode = static_cast<Settings::WindowMode>(Settings::Manager::getInt("window mode", "Video"));
|
||||||
bool windowBorder = settings.getBool("window border", "Video");
|
bool windowBorder = settings.getBool("window border", "Video");
|
||||||
bool vsync = settings.getBool("vsync", "Video");
|
bool vsync = settings.getBool("vsync", "Video");
|
||||||
unsigned int antialiasing = std::max(0, settings.getInt("antialiasing", "Video"));
|
unsigned int antialiasing = std::max(0, settings.getInt("antialiasing", "Video"));
|
||||||
|
@ -562,15 +562,17 @@ void OMW::Engine::createWindow(Settings::Manager& settings)
|
||||||
int pos_x = SDL_WINDOWPOS_CENTERED_DISPLAY(screen),
|
int pos_x = SDL_WINDOWPOS_CENTERED_DISPLAY(screen),
|
||||||
pos_y = SDL_WINDOWPOS_CENTERED_DISPLAY(screen);
|
pos_y = SDL_WINDOWPOS_CENTERED_DISPLAY(screen);
|
||||||
|
|
||||||
if(fullscreen)
|
if(windowMode == Settings::WindowMode::Fullscreen || windowMode == Settings::WindowMode::WindowedFullscreen)
|
||||||
{
|
{
|
||||||
pos_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(screen);
|
pos_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(screen);
|
||||||
pos_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(screen);
|
pos_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint32 flags = SDL_WINDOW_OPENGL|SDL_WINDOW_SHOWN|SDL_WINDOW_RESIZABLE;
|
Uint32 flags = SDL_WINDOW_OPENGL|SDL_WINDOW_SHOWN|SDL_WINDOW_RESIZABLE;
|
||||||
if(fullscreen)
|
if(windowMode == Settings::WindowMode::Fullscreen)
|
||||||
flags |= SDL_WINDOW_FULLSCREEN;
|
flags |= SDL_WINDOW_FULLSCREEN;
|
||||||
|
else if (windowMode == Settings::WindowMode::WindowedFullscreen)
|
||||||
|
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||||
|
|
||||||
// Allows for Windows snapping features to properly work in borderless window
|
// Allows for Windows snapping features to properly work in borderless window
|
||||||
SDL_SetHint("SDL_BORDERLESS_WINDOWED_STYLE", "1");
|
SDL_SetHint("SDL_BORDERLESS_WINDOWED_STYLE", "1");
|
||||||
|
|
|
@ -224,7 +224,7 @@ namespace MWGui
|
||||||
getWidget(mSettingsTab, "SettingsTab");
|
getWidget(mSettingsTab, "SettingsTab");
|
||||||
getWidget(mOkButton, "OkButton");
|
getWidget(mOkButton, "OkButton");
|
||||||
getWidget(mResolutionList, "ResolutionList");
|
getWidget(mResolutionList, "ResolutionList");
|
||||||
getWidget(mFullscreenButton, "FullscreenButton");
|
getWidget(mWindowModeList, "WindowModeList");
|
||||||
getWidget(mWindowBorderButton, "WindowBorderButton");
|
getWidget(mWindowBorderButton, "WindowBorderButton");
|
||||||
getWidget(mTextureFilteringButton, "TextureFilteringButton");
|
getWidget(mTextureFilteringButton, "TextureFilteringButton");
|
||||||
getWidget(mAnisotropyBox, "AnisotropyBox");
|
getWidget(mAnisotropyBox, "AnisotropyBox");
|
||||||
|
@ -274,6 +274,8 @@ namespace MWGui
|
||||||
mLightsResetButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onLightsResetButtonClicked);
|
mLightsResetButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onLightsResetButtonClicked);
|
||||||
mMaxLights->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onMaxLightsChanged);
|
mMaxLights->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onMaxLightsChanged);
|
||||||
|
|
||||||
|
mWindowModeList->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onWindowModeChanged);
|
||||||
|
|
||||||
mKeyboardSwitch->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onKeyboardSwitchClicked);
|
mKeyboardSwitch->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onKeyboardSwitchClicked);
|
||||||
mControllerSwitch->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onControllerSwitchClicked);
|
mControllerSwitch->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onControllerSwitchClicked);
|
||||||
|
|
||||||
|
@ -325,7 +327,8 @@ namespace MWGui
|
||||||
|
|
||||||
updateMaxLightsComboBox(mMaxLights);
|
updateMaxLightsComboBox(mMaxLights);
|
||||||
|
|
||||||
mWindowBorderButton->setEnabled(!Settings::Manager::getBool("fullscreen", "Video"));
|
Settings::WindowMode windowMode = static_cast<Settings::WindowMode>(Settings::Manager::getInt("window mode", "Video"));
|
||||||
|
mWindowBorderButton->setEnabled(windowMode != Settings::WindowMode::Fullscreen && windowMode != Settings::WindowMode::WindowedFullscreen);
|
||||||
|
|
||||||
mKeyboardSwitch->setStateSelected(true);
|
mKeyboardSwitch->setStateSelected(true);
|
||||||
mControllerSwitch->setStateSelected(false);
|
mControllerSwitch->setStateSelected(false);
|
||||||
|
@ -433,6 +436,15 @@ namespace MWGui
|
||||||
apply();
|
apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsWindow::onWindowModeChanged(MyGUI::ComboBox* _sender, size_t pos)
|
||||||
|
{
|
||||||
|
if (pos == MyGUI::ITEM_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Settings::Manager::setInt("window mode", "Video", static_cast<int>(_sender->getIndexSelected()));
|
||||||
|
apply();
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsWindow::onMaxLightsChanged(MyGUI::ComboBox* _sender, size_t pos)
|
void SettingsWindow::onMaxLightsChanged(MyGUI::ComboBox* _sender, size_t pos)
|
||||||
{
|
{
|
||||||
int count = 8 * (pos + 1);
|
int count = 8 * (pos + 1);
|
||||||
|
@ -485,49 +497,6 @@ namespace MWGui
|
||||||
newState = true;
|
newState = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_sender == mFullscreenButton)
|
|
||||||
{
|
|
||||||
// check if this resolution is supported in fullscreen
|
|
||||||
if (mResolutionList->getIndexSelected() != MyGUI::ITEM_NONE)
|
|
||||||
{
|
|
||||||
std::string resStr = mResolutionList->getItemNameAt(mResolutionList->getIndexSelected());
|
|
||||||
int resX, resY;
|
|
||||||
parseResolution (resX, resY, resStr);
|
|
||||||
Settings::Manager::setInt("resolution x", "Video", resX);
|
|
||||||
Settings::Manager::setInt("resolution y", "Video", resY);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool supported = false;
|
|
||||||
int fallbackX = 0, fallbackY = 0;
|
|
||||||
for (unsigned int i=0; i<mResolutionList->getItemCount(); ++i)
|
|
||||||
{
|
|
||||||
std::string resStr = mResolutionList->getItemNameAt(i);
|
|
||||||
int resX, resY;
|
|
||||||
parseResolution (resX, resY, resStr);
|
|
||||||
|
|
||||||
if (i == 0)
|
|
||||||
{
|
|
||||||
fallbackX = resX;
|
|
||||||
fallbackY = resY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resX == Settings::Manager::getInt("resolution x", "Video")
|
|
||||||
&& resY == Settings::Manager::getInt("resolution y", "Video"))
|
|
||||||
supported = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!supported && mResolutionList->getItemCount())
|
|
||||||
{
|
|
||||||
if (fallbackX != 0 && fallbackY != 0)
|
|
||||||
{
|
|
||||||
Settings::Manager::setInt("resolution x", "Video", fallbackX);
|
|
||||||
Settings::Manager::setInt("resolution y", "Video", fallbackY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mWindowBorderButton->setEnabled(!newState);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getSettingType(_sender) == checkButtonType)
|
if (getSettingType(_sender) == checkButtonType)
|
||||||
{
|
{
|
||||||
Settings::Manager::setBool(getSettingName(_sender), getSettingCategory(_sender), newState);
|
Settings::Manager::setBool(getSettingName(_sender), getSettingCategory(_sender), newState);
|
||||||
|
@ -691,6 +660,59 @@ namespace MWGui
|
||||||
mLightingMethodButton->setIndexSelected(mLightingMethodButton->findItemIndexWith(lightingMethodStr));
|
mLightingMethodButton->setIndexSelected(mLightingMethodButton->findItemIndexWith(lightingMethodStr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsWindow::updateWindowModeSettings()
|
||||||
|
{
|
||||||
|
size_t index = static_cast<size_t>(Settings::Manager::getInt("window mode", "Video"));
|
||||||
|
|
||||||
|
if (index > static_cast<size_t>(Settings::WindowMode::Windowed))
|
||||||
|
index = MyGUI::ITEM_NONE;
|
||||||
|
|
||||||
|
mWindowModeList->setIndexSelected(index);
|
||||||
|
|
||||||
|
if (index != static_cast<size_t>(Settings::WindowMode::Windowed) && index != MyGUI::ITEM_NONE)
|
||||||
|
{
|
||||||
|
// check if this resolution is supported in fullscreen
|
||||||
|
if (mResolutionList->getIndexSelected() != MyGUI::ITEM_NONE)
|
||||||
|
{
|
||||||
|
std::string resStr = mResolutionList->getItemNameAt(mResolutionList->getIndexSelected());
|
||||||
|
int resX, resY;
|
||||||
|
parseResolution (resX, resY, resStr);
|
||||||
|
Settings::Manager::setInt("resolution x", "Video", resX);
|
||||||
|
Settings::Manager::setInt("resolution y", "Video", resY);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool supported = false;
|
||||||
|
int fallbackX = 0, fallbackY = 0;
|
||||||
|
for (unsigned int i=0; i<mResolutionList->getItemCount(); ++i)
|
||||||
|
{
|
||||||
|
std::string resStr = mResolutionList->getItemNameAt(i);
|
||||||
|
int resX, resY;
|
||||||
|
parseResolution (resX, resY, resStr);
|
||||||
|
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
fallbackX = resX;
|
||||||
|
fallbackY = resY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resX == Settings::Manager::getInt("resolution x", "Video")
|
||||||
|
&& resY == Settings::Manager::getInt("resolution y", "Video"))
|
||||||
|
supported = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!supported && mResolutionList->getItemCount())
|
||||||
|
{
|
||||||
|
if (fallbackX != 0 && fallbackY != 0)
|
||||||
|
{
|
||||||
|
Settings::Manager::setInt("resolution x", "Video", fallbackX);
|
||||||
|
Settings::Manager::setInt("resolution y", "Video", fallbackY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mWindowBorderButton->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsWindow::layoutControlsBox()
|
void SettingsWindow::layoutControlsBox()
|
||||||
{
|
{
|
||||||
const int h = 18;
|
const int h = 18;
|
||||||
|
@ -866,6 +888,7 @@ namespace MWGui
|
||||||
highlightCurrentResolution();
|
highlightCurrentResolution();
|
||||||
updateControlsBox();
|
updateControlsBox();
|
||||||
updateLightSettings();
|
updateLightSettings();
|
||||||
|
updateWindowModeSettings();
|
||||||
resetScrollbars();
|
resetScrollbars();
|
||||||
renderScriptSettings();
|
renderScriptSettings();
|
||||||
resizeScriptSettings();
|
resizeScriptSettings();
|
||||||
|
|
|
@ -18,6 +18,8 @@ namespace MWGui
|
||||||
|
|
||||||
void updateLightSettings();
|
void updateLightSettings();
|
||||||
|
|
||||||
|
void updateWindowModeSettings();
|
||||||
|
|
||||||
void onResChange(int, int) override { center(); }
|
void onResChange(int, int) override { center(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -26,7 +28,7 @@ namespace MWGui
|
||||||
|
|
||||||
// graphics
|
// graphics
|
||||||
MyGUI::ListBox* mResolutionList;
|
MyGUI::ListBox* mResolutionList;
|
||||||
MyGUI::Button* mFullscreenButton;
|
MyGUI::ComboBox* mWindowModeList;
|
||||||
MyGUI::Button* mWindowBorderButton;
|
MyGUI::Button* mWindowBorderButton;
|
||||||
MyGUI::ComboBox* mTextureFilteringButton;
|
MyGUI::ComboBox* mTextureFilteringButton;
|
||||||
MyGUI::Widget* mAnisotropyBox;
|
MyGUI::Widget* mAnisotropyBox;
|
||||||
|
@ -72,6 +74,8 @@ namespace MWGui
|
||||||
void onLightsResetButtonClicked(MyGUI::Widget* _sender);
|
void onLightsResetButtonClicked(MyGUI::Widget* _sender);
|
||||||
void onMaxLightsChanged(MyGUI::ComboBox* _sender, size_t pos);
|
void onMaxLightsChanged(MyGUI::ComboBox* _sender, size_t pos);
|
||||||
|
|
||||||
|
void onWindowModeChanged(MyGUI::ComboBox* _sender, size_t pos);
|
||||||
|
|
||||||
void onRebindAction(MyGUI::Widget* _sender);
|
void onRebindAction(MyGUI::Widget* _sender);
|
||||||
void onInputTabMouseWheel(MyGUI::Widget* _sender, int _rel);
|
void onInputTabMouseWheel(MyGUI::Widget* _sender, int _rel);
|
||||||
void onResetDefaultBindings(MyGUI::Widget* _sender);
|
void onResetDefaultBindings(MyGUI::Widget* _sender);
|
||||||
|
@ -94,7 +98,7 @@ namespace MWGui
|
||||||
void renderScriptSettings();
|
void renderScriptSettings();
|
||||||
|
|
||||||
void computeMinimumWindowSize();
|
void computeMinimumWindowSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void resetScrollbars();
|
void resetScrollbars();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1086,7 +1086,7 @@ namespace MWGui
|
||||||
else if (setting.first == "Video" && (
|
else if (setting.first == "Video" && (
|
||||||
setting.second == "resolution x"
|
setting.second == "resolution x"
|
||||||
|| setting.second == "resolution y"
|
|| setting.second == "resolution y"
|
||||||
|| setting.second == "fullscreen"
|
|| setting.second == "window mode"
|
||||||
|| setting.second == "window border"))
|
|| setting.second == "window border"))
|
||||||
changeRes = true;
|
changeRes = true;
|
||||||
|
|
||||||
|
@ -1101,7 +1101,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
mVideoWrapper->setVideoMode(Settings::Manager::getInt("resolution x", "Video"),
|
mVideoWrapper->setVideoMode(Settings::Manager::getInt("resolution x", "Video"),
|
||||||
Settings::Manager::getInt("resolution y", "Video"),
|
Settings::Manager::getInt("resolution y", "Video"),
|
||||||
Settings::Manager::getBool("fullscreen", "Video"),
|
static_cast<Settings::WindowMode>(Settings::Manager::getInt("window mode", "Video")),
|
||||||
Settings::Manager::getBool("window border", "Video"));
|
Settings::Manager::getBool("window border", "Video"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "sdlvideowrapper.hpp"
|
#include "sdlvideowrapper.hpp"
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
|
#include <components/settings/settings.hpp>
|
||||||
|
|
||||||
#include <osgViewer/Viewer>
|
#include <osgViewer/Viewer>
|
||||||
|
|
||||||
|
@ -68,21 +69,21 @@ namespace SDLUtil
|
||||||
Log(Debug::Warning) << "Couldn't set gamma: " << SDL_GetError();
|
Log(Debug::Warning) << "Couldn't set gamma: " << SDL_GetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoWrapper::setVideoMode(int width, int height, bool fullscreen, bool windowBorder)
|
void VideoWrapper::setVideoMode(int width, int height, Settings::WindowMode windowMode, bool windowBorder)
|
||||||
{
|
{
|
||||||
SDL_SetWindowFullscreen(mWindow, 0);
|
SDL_SetWindowFullscreen(mWindow, 0);
|
||||||
|
|
||||||
if (SDL_GetWindowFlags(mWindow) & SDL_WINDOW_MAXIMIZED)
|
if (SDL_GetWindowFlags(mWindow) & SDL_WINDOW_MAXIMIZED)
|
||||||
SDL_RestoreWindow(mWindow);
|
SDL_RestoreWindow(mWindow);
|
||||||
|
|
||||||
if (fullscreen)
|
if (windowMode == Settings::WindowMode::Fullscreen || windowMode == Settings::WindowMode::WindowedFullscreen)
|
||||||
{
|
{
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
SDL_GetWindowDisplayMode(mWindow, &mode);
|
SDL_GetWindowDisplayMode(mWindow, &mode);
|
||||||
mode.w = width;
|
mode.w = width;
|
||||||
mode.h = height;
|
mode.h = height;
|
||||||
SDL_SetWindowDisplayMode(mWindow, &mode);
|
SDL_SetWindowDisplayMode(mWindow, &mode);
|
||||||
SDL_SetWindowFullscreen(mWindow, fullscreen);
|
SDL_SetWindowFullscreen(mWindow, windowMode == Settings::WindowMode::Fullscreen ? SDL_WINDOW_FULLSCREEN : SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,11 @@ namespace osgViewer
|
||||||
class Viewer;
|
class Viewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Settings
|
||||||
|
{
|
||||||
|
enum class WindowMode;
|
||||||
|
}
|
||||||
|
|
||||||
namespace SDLUtil
|
namespace SDLUtil
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -25,7 +30,7 @@ namespace SDLUtil
|
||||||
|
|
||||||
void setGammaContrast(float gamma, float contrast);
|
void setGammaContrast(float gamma, float contrast);
|
||||||
|
|
||||||
void setVideoMode(int width, int height, bool fullscreen, bool windowBorder);
|
void setVideoMode(int width, int height, Settings::WindowMode windowMode, bool windowBorder);
|
||||||
|
|
||||||
void centerWindow();
|
void centerWindow();
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,13 @@ namespace Files
|
||||||
|
|
||||||
namespace Settings
|
namespace Settings
|
||||||
{
|
{
|
||||||
|
enum class WindowMode
|
||||||
|
{
|
||||||
|
Fullscreen = 0,
|
||||||
|
WindowedFullscreen,
|
||||||
|
Windowed
|
||||||
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \brief Settings management (can change during runtime)
|
/// \brief Settings management (can change during runtime)
|
||||||
///
|
///
|
||||||
|
|
|
@ -31,17 +31,24 @@ The window resolution can be selected from a menu of common screen sizes
|
||||||
in the Video tab of the Video Panel of the Options menu, or in the Graphics tab of the OpenMW Launcher.
|
in the Video tab of the Video Panel of the Options menu, or in the Graphics tab of the OpenMW Launcher.
|
||||||
The vertical resolution can also be set to a custom value in the Graphics tab of the OpenMW Launcher.
|
The vertical resolution can also be set to a custom value in the Graphics tab of the OpenMW Launcher.
|
||||||
|
|
||||||
fullscreen
|
window mode
|
||||||
----------
|
-----------
|
||||||
|
|
||||||
:Type: boolean
|
:Type: integer
|
||||||
:Range: True/False
|
:Range: 0, 1, 2
|
||||||
:Default: False
|
:Default: 2 (Windowed)
|
||||||
|
|
||||||
This setting determines whether the entire screen is used for the specified resolution.
|
This setting determines the window mode.
|
||||||
|
|
||||||
This setting can be toggled in game using the Fullscreen button in the Video tab of the Video panel in the Options menu.
|
0: Exclusive fullscreen
|
||||||
It can also be toggled with the Full Screen check box in the Graphics tab of the OpenMW Launcher.
|
|
||||||
|
1: Windowed fullscreen, borderless window that matches screen resolution
|
||||||
|
|
||||||
|
2: Windowed
|
||||||
|
|
||||||
|
|
||||||
|
This setting can be toggled in game using the dropdown list in the Video tab of the Video panel in the Options menu.
|
||||||
|
It can also be toggled with the window mode dropdown in the Graphics tab of the OpenMW Launcher.
|
||||||
|
|
||||||
screen
|
screen
|
||||||
------
|
------
|
||||||
|
|
|
@ -270,17 +270,17 @@
|
||||||
<Widget type="TabItem" skin="" position="0 28 352 268" align="Stretch">
|
<Widget type="TabItem" skin="" position="0 28 352 268" align="Stretch">
|
||||||
<Property key="Caption" value=" Video "/>
|
<Property key="Caption" value=" Video "/>
|
||||||
<Widget type="ListBox" skin="MW_List" position="0 4 170 170" align="Left Top" name="ResolutionList"/>
|
<Widget type="ListBox" skin="MW_List" position="0 4 170 170" align="Left Top" name="ResolutionList"/>
|
||||||
<Widget type="HBox" skin="" position="182 4 300 24">
|
<Widget type="TextBox" skin="NormalText" position="182 4 170 18" align="Left Top">
|
||||||
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="FullscreenButton">
|
<Property key="Caption" value="Window Mode:"/>
|
||||||
<UserString key="SettingCategory" value="Video"/>
|
</Widget>
|
||||||
<UserString key="SettingName" value="fullscreen"/>
|
<Widget type="HBox" skin="" position="182 28 300 24">
|
||||||
<UserString key="SettingType" value="CheckButton"/>
|
<Widget type="ComboBox" skin="MW_ComboBox" position="0 0 200 24" align="Left Top" name="WindowModeList">
|
||||||
</Widget>
|
<Property key="AddItem" value="Fullscreen"/>
|
||||||
<Widget type="AutoSizedTextBox" skin="SandText" position="28 4 70 16" align="Left Top">
|
<Property key="AddItem" value="Windowed Fullscreen"/>
|
||||||
<Property key="Caption" value="Fullscreen"/>
|
<Property key="AddItem" value="Windowed"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="HBox" skin="" position="182 34 300 24">
|
<Widget type="HBox" skin="" position="182 64 300 24">
|
||||||
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="VSyncButton">
|
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="VSyncButton">
|
||||||
<UserString key="SettingCategory" value="Video"/>
|
<UserString key="SettingCategory" value="Video"/>
|
||||||
<UserString key="SettingName" value="vsync"/>
|
<UserString key="SettingName" value="vsync"/>
|
||||||
|
@ -290,7 +290,7 @@
|
||||||
<Property key="Caption" value="VSync"/>
|
<Property key="Caption" value="VSync"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="HBox" skin="" position="182 64 300 24">
|
<Widget type="HBox" skin="" position="182 94 300 24">
|
||||||
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="WindowBorderButton">
|
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="WindowBorderButton">
|
||||||
<UserString key="SettingCategory" value="Video"/>
|
<UserString key="SettingCategory" value="Video"/>
|
||||||
<UserString key="SettingName" value="window border"/>
|
<UserString key="SettingName" value="window border"/>
|
||||||
|
@ -301,7 +301,7 @@
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<Widget type="TextBox" skin="SandText" position="182 94 300 32" align="Left Top">
|
<Widget type="TextBox" skin="SandText" position="182 124 300 32" align="Left Top">
|
||||||
<Property key="Caption" value="Hint: press F3 to show \nthe current frame rate."/>
|
<Property key="Caption" value="Hint: press F3 to show \nthe current frame rate."/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
|
|
@ -611,8 +611,9 @@ hrtf =
|
||||||
resolution x = 800
|
resolution x = 800
|
||||||
resolution y = 600
|
resolution y = 600
|
||||||
|
|
||||||
# OpenMW takes complete control of the screen.
|
# Specify the window mode.
|
||||||
fullscreen = false
|
# 0 = Fullscreen, 1 = Windowed Fullscreen, 2 = Windowed
|
||||||
|
window mode = 0
|
||||||
|
|
||||||
# Determines which screen OpenMW is on. (>=0).
|
# Determines which screen OpenMW is on. (>=0).
|
||||||
screen = 0
|
screen = 0
|
||||||
|
|
|
@ -112,17 +112,39 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QCheckBox" name="windowBorderCheckBox">
|
<widget class="QCheckBox" name="windowBorderCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Window Border</string>
|
<string>Window Border</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="1">
|
||||||
<widget class="QCheckBox" name="fullScreenCheckBox">
|
<widget class="QComboBox" name="windowModeComboBox">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Fullscreen</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Windowed Fullscreen</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Windowed</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="windowModeLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Full Screen</string>
|
<string>Window Mode:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in a new issue