|
@@ -102,9 +102,13 @@ GeneralOptionsTab::GeneralOptionsTab()
|
|
|
targetLabel->setText(std::to_string(value) + "%");
|
|
|
});
|
|
|
//settings that do not belong to base game:
|
|
|
- addCallback("fullscreenChanged", [this](bool value)
|
|
|
+ addCallback("fullscreenBorderlessChanged", [this](bool value)
|
|
|
{
|
|
|
- setFullscreenMode(value);
|
|
|
+ setFullscreenMode(value, false);
|
|
|
+ });
|
|
|
+ addCallback("fullscreenExclusiveChanged", [this](bool value)
|
|
|
+ {
|
|
|
+ setFullscreenMode(value, true);
|
|
|
});
|
|
|
addCallback("setGameResolution", [this](int dummyValue)
|
|
|
{
|
|
@@ -135,7 +139,8 @@ GeneralOptionsTab::GeneralOptionsTab()
|
|
|
const auto & currentResolution = settings["video"]["resolution"];
|
|
|
|
|
|
std::shared_ptr<CLabel> resolutionLabel = widget<CLabel>("resolutionLabel");
|
|
|
- resolutionLabel->setText(resolutionToLabelString(currentResolution["width"].Integer(), currentResolution["height"].Integer()));
|
|
|
+ if (resolutionLabel)
|
|
|
+ resolutionLabel->setText(resolutionToLabelString(currentResolution["width"].Integer(), currentResolution["height"].Integer()));
|
|
|
|
|
|
std::shared_ptr<CLabel> scalingLabel = widget<CLabel>("scalingLabel");
|
|
|
scalingLabel->setText(scalingToLabelString(currentResolution["scaling"].Integer()));
|
|
@@ -143,12 +148,13 @@ GeneralOptionsTab::GeneralOptionsTab()
|
|
|
std::shared_ptr<CToggleButton> spellbookAnimationCheckbox = widget<CToggleButton>("spellbookAnimationCheckbox");
|
|
|
spellbookAnimationCheckbox->setSelected(settings["video"]["spellbookAnimation"].Bool());
|
|
|
|
|
|
- std::shared_ptr<CToggleButton> fullscreenCheckbox = widget<CToggleButton>("fullscreenCheckbox");
|
|
|
- fullscreenCheckbox->setSelected(settings["video"]["fullscreen"].Bool());
|
|
|
- onFullscreenChanged([&](const JsonNode &newState) //used when pressing F4 etc. to change fullscreen checkbox state
|
|
|
- {
|
|
|
- widget<CToggleButton>("fullscreenCheckbox")->setSelected(newState.Bool());
|
|
|
- });
|
|
|
+ std::shared_ptr<CToggleButton> fullscreenBorderlessCheckbox = widget<CToggleButton>("fullscreenBorderlessCheckbox");
|
|
|
+ if (fullscreenBorderlessCheckbox)
|
|
|
+ fullscreenBorderlessCheckbox->setSelected(settings["video"]["fullscreen"].Bool() && !settings["video"]["realFullscreen"].Bool());
|
|
|
+
|
|
|
+ std::shared_ptr<CToggleButton> fullscreenExclusiveCheckbox = widget<CToggleButton>("fullscreenExclusiveCheckbox");
|
|
|
+ if (fullscreenExclusiveCheckbox)
|
|
|
+ fullscreenExclusiveCheckbox->setSelected(settings["video"]["fullscreen"].Bool() && settings["video"]["realFullscreen"].Bool());
|
|
|
|
|
|
std::shared_ptr<CToggleButton> framerateCheckbox = widget<CToggleButton>("framerateCheckbox");
|
|
|
framerateCheckbox->setSelected(settings["video"]["showfps"].Bool());
|
|
@@ -170,16 +176,6 @@ GeneralOptionsTab::GeneralOptionsTab()
|
|
|
|
|
|
std::shared_ptr<CLabel> soundVolumeLabel = widget<CLabel>("soundValueLabel");
|
|
|
soundVolumeLabel->setText(std::to_string(CCS->soundh->getVolume()) + "%");
|
|
|
-
|
|
|
-#ifdef VCMI_MOBILE
|
|
|
- // On mobile platforms, VCMI always uses OS screen resolutions
|
|
|
- // Players can control UI size via "Interface Scaling" option instead
|
|
|
- std::shared_ptr<CButton> resolutionButton = widget<CButton>("resolutionButton");
|
|
|
-
|
|
|
- resolutionButton->disable();
|
|
|
- resolutionLabel->disable();
|
|
|
- fullscreenCheckbox->block(true);
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
void GeneralOptionsTab::selectGameResolution()
|
|
@@ -224,9 +220,19 @@ void GeneralOptionsTab::setGameResolution(int index)
|
|
|
widget<CLabel>("resolutionLabel")->setText(resolutionToLabelString(resolution.x, resolution.y));
|
|
|
}
|
|
|
|
|
|
-void GeneralOptionsTab::setFullscreenMode(bool on)
|
|
|
+void GeneralOptionsTab::setFullscreenMode(bool on, bool exclusive)
|
|
|
{
|
|
|
+ setBoolSetting("video", "realFullscreen", exclusive);
|
|
|
setBoolSetting("video", "fullscreen", on);
|
|
|
+
|
|
|
+ std::shared_ptr<CToggleButton> fullscreenExclusiveCheckbox = widget<CToggleButton>("fullscreenExclusiveCheckbox");
|
|
|
+ std::shared_ptr<CToggleButton> fullscreenBorderlessCheckbox = widget<CToggleButton>("fullscreenBorderlessCheckbox");
|
|
|
+
|
|
|
+ if (fullscreenBorderlessCheckbox)
|
|
|
+ fullscreenBorderlessCheckbox->setSelected(on && !exclusive);
|
|
|
+
|
|
|
+ if (fullscreenExclusiveCheckbox)
|
|
|
+ fullscreenExclusiveCheckbox->setSelected(on && exclusive);
|
|
|
}
|
|
|
|
|
|
void GeneralOptionsTab::selectGameScaling()
|