joshtynjala Thanks Josh! You're right, contentsScaleFactor
is right when <requestedDisplayResolution>high</requestedDisplayResolution>
is set ๐
Thanks maxddd too!
Okay, so now I can properly compute the best textures scaling by doing:
public static function computeRecommendedTexturesScaleFromScreen():Number
{
Log.info("[Resources Controller] Finding recommended textures scale for current screen...");
Log.info("[Resources Controller] Native stage's content scale factor: " + Starling.current.nativeStage.contentsScaleFactor);
var fullScreenWidth:uint = Starling.current.nativeStage.fullScreenWidth * Starling.current.nativeStage.contentsScaleFactor;
var fullScreenHeight:uint = Starling.current.nativeStage.fullScreenHeight * Starling.current.nativeStage.contentsScaleFactor;
var fullscreenPixels:uint = fullScreenWidth * fullScreenHeight;
Log.info("[Resources Controller] Fullscreen resolution: " + fullScreenWidth + "x" + fullScreenHeight);
var bestPixelsDiff:uint = uint.MAX_VALUE;
var bestTexturesScale:Number = SUPPORTED_TEXTURE_SCALES[0];
for each (var scale:Number in SUPPORTED_TEXTURE_SCALES)
{
var scalePixelsDiff:uint = 800 * scale * 480 * scale;
if (Math.abs(scalePixelsDiff - fullscreenPixels) < bestPixelsDiff)
{
bestTexturesScale = scale;
bestPixelsDiff = Math.abs(scalePixelsDiff - fullscreenPixels);
}
}
Log.info("[Resources Controller] Recommended textures scale: " + bestTexturesScale + "x (" + 800 * bestTexturesScale + "x" + 480 * bestTexturesScale + ")");
return bestTexturesScale;
}
Note: 800x480 is texture scale of 1.0
Everything seems to be fine from the logs now:
[2020-08-31 21:25:46.319] [INFO ] [Resources Controller] Finding recommended textures scale for current screen...
[2020-08-31 21:25:46.319] [INFO ] [Resources Controller] Native stage's content scale factor: 2.25
[2020-08-31 21:25:46.319] [INFO ] [Resources Controller] Fullscreen resolution: 2560x1440
[2020-08-31 21:25:46.319] [INFO ] [Resources Controller] Recommended textures scale: 3x (2400x1440)
๐ฉ Now the game looks slightly better in full screen but doesn't match the quality of a DPI scaling of 100% yet... ๐ค
Does anyone have any other track to investigate on?
Thanks in advance for your help.