mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Add optional real fullscreen mode support
This commit is contained in:
parent
4d204095cf
commit
c377f594a5
@ -1071,12 +1071,17 @@ static bool recreateWindow(int w, int h, int bpp, bool fullscreen, int displayIn
|
||||
|
||||
cleanupRenderer();
|
||||
|
||||
bool realFullscreen = settings["video"]["realFullscreen"].Bool();
|
||||
|
||||
#ifdef VCMI_ANDROID
|
||||
mainWindow = SDL_CreateWindow(NAME.c_str(), SDL_WINDOWPOS_UNDEFINED_DISPLAY(displayIndex),SDL_WINDOWPOS_UNDEFINED_DISPLAY(displayIndex), 0, 0, SDL_WINDOW_FULLSCREEN);
|
||||
#else
|
||||
|
||||
if(fullscreen)
|
||||
{
|
||||
//in full-screen mode always use desktop resolution
|
||||
if(realFullscreen)
|
||||
mainWindow = SDL_CreateWindow(NAME.c_str(), SDL_WINDOWPOS_UNDEFINED_DISPLAY(displayIndex), SDL_WINDOWPOS_UNDEFINED_DISPLAY(displayIndex), w, h, SDL_WINDOW_FULLSCREEN);
|
||||
else //in windowed full-screen mode use desktop resolution
|
||||
mainWindow = SDL_CreateWindow(NAME.c_str(), SDL_WINDOWPOS_UNDEFINED_DISPLAY(displayIndex),SDL_WINDOWPOS_UNDEFINED_DISPLAY(displayIndex), 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
|
||||
}
|
||||
@ -1104,13 +1109,15 @@ static bool recreateWindow(int w, int h, int bpp, bool fullscreen, int displayIn
|
||||
SDL_GetRendererInfo(mainRenderer,&info);
|
||||
logGlobal->infoStream() << "Created renderer " << info.name;
|
||||
|
||||
if(!(fullscreen && realFullscreen))
|
||||
{
|
||||
SDL_RenderSetLogicalSize(mainRenderer, w, h);
|
||||
|
||||
#ifndef VCMI_ANDROID
|
||||
// on android this stretches the game to fit the screen, not preserving aspect and apparently this also breaks coordinates scaling in mouse events
|
||||
SDL_RenderSetViewport(mainRenderer, nullptr);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||
|
@ -53,7 +53,7 @@
|
||||
"type" : "object",
|
||||
"additionalProperties" : false,
|
||||
"default": {},
|
||||
"required" : [ "screenRes", "bitsPerPixel", "fullscreen", "spellbookAnimation","driver", "showIntro", "displayIndex" ],
|
||||
"required" : [ "screenRes", "bitsPerPixel", "fullscreen", "realFullscreen", "spellbookAnimation","driver", "showIntro", "displayIndex" ],
|
||||
"properties" : {
|
||||
"screenRes" : {
|
||||
"type" : "object",
|
||||
@ -73,6 +73,10 @@
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"realFullscreen" : {
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
},
|
||||
"showIntro" : {
|
||||
"type" : "boolean",
|
||||
"default" : true
|
||||
|
@ -44,6 +44,7 @@ void CSettingsView::loadSettings()
|
||||
ui->comboBoxResolution->setCurrentIndex(resIndex);
|
||||
ui->comboBoxFullScreen->setCurrentIndex(settings["video"]["fullscreen"].Bool());
|
||||
ui->comboBoxShowIntro->setCurrentIndex(settings["video"]["showIntro"].Bool());
|
||||
ui->checkBoxFullScreen->setChecked(settings["video"]["realFullscreen"].Bool());
|
||||
|
||||
int friendlyAIIndex = ui->comboBoxFriendlyAI->findText(QString::fromUtf8(settings["server"]["friendlyAI"].String().c_str()));
|
||||
int neutralAIIndex = ui->comboBoxNeutralAI->findText(QString::fromUtf8(settings["server"]["neutralAI"].String().c_str()));
|
||||
@ -89,6 +90,7 @@ CSettingsView::~CSettingsView()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void CSettingsView::on_comboBoxResolution_currentIndexChanged(const QString &arg1)
|
||||
{
|
||||
QStringList list = arg1.split("x");
|
||||
@ -104,6 +106,12 @@ void CSettingsView::on_comboBoxFullScreen_currentIndexChanged(int index)
|
||||
node->Bool() = index;
|
||||
}
|
||||
|
||||
void CSettingsView::on_checkBoxFullScreen_stateChanged(int state)
|
||||
{
|
||||
Settings node = settings.write["video"]["realFullscreen"];
|
||||
node->Bool() = state;
|
||||
}
|
||||
|
||||
void CSettingsView::on_comboBoxAutoCheck_currentIndexChanged(int index)
|
||||
{
|
||||
Settings node = settings.write["launcher"]["autoCheckRepositories"];
|
||||
|
@ -16,6 +16,8 @@ public:
|
||||
void setDisplayList(const QStringList& displayList);
|
||||
|
||||
private slots:
|
||||
void on_checkBoxFullScreen_stateChanged(int state);
|
||||
|
||||
void on_comboBoxResolution_currentIndexChanged(const QString &arg1);
|
||||
|
||||
void on_comboBoxFullScreen_currentIndexChanged(int index);
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>738</width>
|
||||
<height>459</height>
|
||||
<height>471</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -26,6 +26,30 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="3" column="6">
|
||||
<widget class="QLabel" name="labelTempDir">
|
||||
<property name="text">
|
||||
<string>Log files directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="6">
|
||||
<widget class="QComboBox" name="comboBoxAutoCheck">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Off</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>On</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6" colspan="4">
|
||||
<widget class="QLabel" name="labelDataDirs">
|
||||
<property name="font">
|
||||
@ -66,7 +90,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="4">
|
||||
<item row="11" column="4">
|
||||
<widget class="QComboBox" name="comboBoxNeutralAI">
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -87,7 +111,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="14" column="1">
|
||||
<widget class="QLabel" name="labelEnemyAI">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -100,7 +124,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1" colspan="4">
|
||||
<item row="17" column="1" colspan="4">
|
||||
<widget class="QLabel" name="labelAutoCheck">
|
||||
<property name="text">
|
||||
<string>Check repositories on startup</string>
|
||||
@ -121,7 +145,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="6" colspan="4">
|
||||
<item row="8" column="6" colspan="4">
|
||||
<widget class="QLabel" name="labelGeneral">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -153,7 +177,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="4">
|
||||
<item row="9" column="4">
|
||||
<widget class="QComboBox" name="comboBoxPlayerAI">
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -181,31 +205,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="6">
|
||||
<widget class="QLabel" name="labelTempDir">
|
||||
<property name="text">
|
||||
<string>Log files directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="6">
|
||||
<widget class="QComboBox" name="comboBoxAutoCheck">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Off</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>On</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1" colspan="4">
|
||||
<item row="18" column="1" colspan="4">
|
||||
<widget class="QLabel" name="labelRepositories">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -225,7 +225,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="7" colspan="3">
|
||||
<item row="9" column="7" colspan="3">
|
||||
<widget class="QSpinBox" name="spinBoxNetworkPort">
|
||||
<property name="minimum">
|
||||
<number>1024</number>
|
||||
@ -238,7 +238,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="1" colspan="9">
|
||||
<item row="20" column="1" colspan="9">
|
||||
<widget class="QPlainTextEdit" name="plainTextEditRepos">
|
||||
<property name="lineWrapMode">
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
@ -255,7 +255,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<item row="13" column="1">
|
||||
<widget class="QLabel" name="labelFriendlyAI">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -268,14 +268,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="labelPlayerAI">
|
||||
<property name="text">
|
||||
<string>Player AI</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="4">
|
||||
<item row="14" column="4">
|
||||
<widget class="QComboBox" name="comboBoxEnemyAI">
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
@ -302,7 +302,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="4">
|
||||
<item row="7" column="1" colspan="4">
|
||||
<spacer name="spacerSections">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -374,7 +374,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="4">
|
||||
<item row="8" column="1" colspan="4">
|
||||
<widget class="QLabel" name="labelAIMovingOnTheMap">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -404,7 +404,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1" colspan="4">
|
||||
<item row="16" column="1" colspan="4">
|
||||
<widget class="QLabel" name="LauncherSettings">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -417,7 +417,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="6">
|
||||
<item row="9" column="6">
|
||||
<widget class="QLabel" name="labelNetworkPort">
|
||||
<property name="text">
|
||||
<string>Network port</string>
|
||||
@ -486,7 +486,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1" colspan="4">
|
||||
<item row="15" column="1" colspan="4">
|
||||
<spacer name="spacerRepos">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -502,7 +502,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="11" column="4">
|
||||
<item row="13" column="4">
|
||||
<widget class="QComboBox" name="comboBoxFriendlyAI">
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
@ -522,7 +522,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="7" colspan="3">
|
||||
<item row="10" column="7" colspan="3">
|
||||
<widget class="QComboBox" name="comboBoxEncoding">
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -551,7 +551,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="labelAIInTheBattlefield">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -566,7 +566,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="5">
|
||||
<item row="11" column="5">
|
||||
<spacer name="spacerColumns">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -582,20 +582,27 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="6">
|
||||
<item row="10" column="6">
|
||||
<widget class="QLabel" name="labelEncoding">
|
||||
<property name="text">
|
||||
<string>Heroes III character set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="QLabel" name="labelNeutralAI">
|
||||
<property name="text">
|
||||
<string>Neutral AI</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QCheckBox" name="checkBoxFullScreen">
|
||||
<property name="text">
|
||||
<string>Real fullscreen mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
Loading…
Reference in New Issue
Block a user