@naghekyan I am glad that it was useful to you.
-
Is there a recommended way to set Design Resolution depending on screen or resource size?
I think it depends on the layout and on your preferences. I use to design resolution the smallest of my resource resolutions.
-
There are 5 different policies. Only one introduces distortion as aspect ratio is not preserved. It is in case of Exact fit policy. But in case of Fixed Height and Fixed Width I also expect to see distortion because of aspect ratio violation. Otherwise I see not difference between No border, Fixed Height and Fixed Width. They all preserve aspect ratio and they appear on screen with some cropping and with no borders. What is the difference then?
You are right,
EXACT_FIT can distort the picture if the aspect ratio in the screen resolutions and design resolutions is not the same.
SHOW_ALL show the whole picture without distortion, but may appear with horizontal or vertical black borders.
NO_BORDER show the picture without distortion, but may not be visible part of the picture.
FIXED_HEIGHT guaranteed show the whole picture vertically, but horizontally picture can be trimmed, or vice versa may appear with vertical black borders, if the picture was not wide enough.
FIXED_WIDTH guaranteed show the whole picture horizontally, but vertically picture can be trimmed, or vice versa may appear with horizontal black borders, if the picture was not wide enough.
The difference between NO_BORDER and FIXED_HEIGHT (FIXED_WIDTH) is that in the case of use FIXED_HEIGHT the borders may appear, or may not appear.
!!!
And now, most importantly, all this is true only for the conversion of the design resolution in screen resolution.
It is all just transform the intermediate picture which was calculated for design resolution. Here is the answer to your fourth question. But first things first.
-
How visible size and visible origin is calculated?
You can get the visible size and visible origin of the calling Director::getInstance()->getVisibleSize()
and Director::getInstance()->getVisibleOrigin()
. It calculates the engine itself.
-
And as you can see in the image there are right and left borders, whereas the policy is No Border. Is there a contradictions? Also as you can see X axis in not cut. Instead there are borders.
This is correct. Just in these two examples used different resource resolutions.
In the first case, the author had in mind, he has a fairly broad picture, and, if necessary, he can sacrifice a part of this width. Therefore, does not appear any borders, after transformation from resource resolution to design resolution. Then follows the transformation from design resolution to screen resolution.
In the second case, vertical borders appear after after transformation from resource resolution to design resolution because the resource image is not wide enough. And does not appear any new boundaries aftertransformation from design resolution to screen resolution. But the old boundaries are not lost as yet been calculated in the previous step.
Thus, if you intend to use this tactic, you should make sure that your image was wide enough and you could easily sacrifice the left and right side.
Unfortunately I do not have time to do high-quality images for this.