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