mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Always show correct game resolution in settings, unaffected by scaling
This commit is contained in:
parent
57e7db7fdf
commit
8dc009e2c9
@ -37,4 +37,7 @@ public:
|
||||
|
||||
/// Converts provided rect from logical coordinates into coordinates within window, accounting for scaling and viewport
|
||||
virtual Rect convertLogicalPointsToWindow(const Rect & input) const = 0;
|
||||
|
||||
/// Dimensions of render output
|
||||
virtual Point getRenderResolution() const = 0;
|
||||
};
|
||||
|
@ -46,7 +46,7 @@ std::tuple<int, int> ScreenHandler::getSupportedScalingRange() const
|
||||
// arbitrary limit on *downscaling*. Allow some downscaling, if requested by user. Should be generally limited to 100+ for all but few devices
|
||||
static const double minimalScaling = 50;
|
||||
|
||||
Point renderResolution = getActualRenderResolution();
|
||||
Point renderResolution = getRenderResolution();
|
||||
double reservedAreaWidth = settings["video"]["reservedWidth"].Float();
|
||||
Point availableResolution = Point(renderResolution.x * (1 - reservedAreaWidth), renderResolution.y);
|
||||
|
||||
@ -85,7 +85,7 @@ Rect ScreenHandler::convertLogicalPointsToWindow(const Rect & input) const
|
||||
|
||||
Point ScreenHandler::getPreferredLogicalResolution() const
|
||||
{
|
||||
Point renderResolution = getActualRenderResolution();
|
||||
Point renderResolution = getRenderResolution();
|
||||
double reservedAreaWidth = settings["video"]["reservedWidth"].Float();
|
||||
Point availableResolution = Point(renderResolution.x * (1 - reservedAreaWidth), renderResolution.y);
|
||||
|
||||
@ -99,7 +99,7 @@ Point ScreenHandler::getPreferredLogicalResolution() const
|
||||
return logicalResolution;
|
||||
}
|
||||
|
||||
Point ScreenHandler::getActualRenderResolution() const
|
||||
Point ScreenHandler::getRenderResolution() const
|
||||
{
|
||||
assert(mainRenderer != nullptr);
|
||||
|
||||
|
@ -39,9 +39,6 @@ class ScreenHandler final : public IScreenHandler
|
||||
/// This value is what player views as window size
|
||||
Point getPreferredWindowResolution() const;
|
||||
|
||||
/// Dimensions of render output, usually same as window size except for high-DPI screens on macOS / iOS
|
||||
Point getActualRenderResolution() const;
|
||||
|
||||
EWindowMode getPreferredWindowMode() const;
|
||||
|
||||
/// Returns index of display on which window should be created
|
||||
@ -86,6 +83,9 @@ public:
|
||||
/// Fills screen with black color, erasing any existing content
|
||||
void clearScreen() final;
|
||||
|
||||
/// Dimensions of render output, usually same as window size except for high-DPI screens on macOS / iOS
|
||||
Point getRenderResolution() const final;
|
||||
|
||||
std::vector<Point> getSupportedResolutions() const final;
|
||||
std::vector<Point> getSupportedResolutions(int displayIndex) const;
|
||||
std::tuple<int, int> getSupportedScalingRange() const final;
|
||||
|
@ -224,25 +224,19 @@ void GeneralOptionsTab::updateResolutionSelector()
|
||||
std::shared_ptr<CButton> resolutionButton = widget<CButton>("resolutionButton");
|
||||
std::shared_ptr<CLabel> resolutionLabel = widget<CLabel>("resolutionLabel");
|
||||
|
||||
if (settings["video"]["fullscreen"].Bool() && !settings["video"]["realFullscreen"].Bool())
|
||||
if (resolutionButton)
|
||||
{
|
||||
if (resolutionButton)
|
||||
if (settings["video"]["fullscreen"].Bool() && !settings["video"]["realFullscreen"].Bool())
|
||||
resolutionButton->disable();
|
||||
|
||||
if (resolutionLabel)
|
||||
resolutionLabel->setText(resolutionToLabelString(GH.screenDimensions().x, GH.screenDimensions().y));
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto & currentResolution = settings["video"]["resolution"];
|
||||
|
||||
if (resolutionButton)
|
||||
else
|
||||
resolutionButton->enable();
|
||||
|
||||
if (resolutionLabel)
|
||||
resolutionLabel->setText(resolutionToLabelString(currentResolution["width"].Integer(), currentResolution["height"].Integer()));
|
||||
}
|
||||
|
||||
if (resolutionLabel)
|
||||
{
|
||||
Point resolution = GH.screenHandler().getRenderResolution();
|
||||
resolutionLabel->setText(resolutionToLabelString(resolution.x, resolution.y));
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralOptionsTab::selectGameResolution()
|
||||
|
Loading…
x
Reference in New Issue
Block a user