1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

First iteration of upscaled rendering

This commit is contained in:
Ivan Savenko
2024-07-21 21:11:02 +00:00
parent 7f5cd8a7aa
commit 4171026035
13 changed files with 294 additions and 26 deletions

View File

@@ -41,8 +41,10 @@ static const std::string NAME = GameConstants::VCMI_VERSION; //application name
std::tuple<int, int> ScreenHandler::getSupportedScalingRange() const
{
// Renderer upscaling factor. TODO: make configurable
static const int scalingFactor = 2;
// H3 resolution, any resolution smaller than that is not correctly supported
static const Point minResolution = {800, 600};
static const Point minResolution = Point(800, 600) * scalingFactor;
// 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;
@@ -99,6 +101,16 @@ Point ScreenHandler::getPreferredLogicalResolution() const
return logicalResolution;
}
int ScreenHandler::getScalingFactor() const
{
return 2;
}
Point ScreenHandler::getLogicalResolution() const
{
return Point(screen->w, screen->h) / getScalingFactor();
}
Point ScreenHandler::getRenderResolution() const
{
assert(mainRenderer != nullptr);