Hi all,
A beginner here to Cocos2d-JS. I am currently using Cocos Creator and am trying to learn about design resolutions. I read this thread What is design resolution?, which has been mighty useful. However, when I am doing my own experiments on Cocos Creator I run into some unexpected results. My setup is below:
Canvas:
Design resolution: 640 x 200 (W x H)
Fit Height not selected.
Fit Width selected (So I guess I am using cc.ResolutionPolicy.FIXED_WIDTH)
Preview Resolution: 640 x 360 (WxH)
I expect for the canvas content to fill up the preview screen (at the scale of 1 for x-axis), width-wise but there would be black borders on the top part of the screen as the height of the design resolution is not enough for the screen. But to my surprise, the preview came out as though Fit Height has been selected - that is the screen is fitted height-wise and there is no black borders in the preview screen.
Selecting Fit Height produced what I would have expected. Black borders only appear when I select both Fit Height and Fit Width, which is again expected.
When I changed my setup to be:
Canvas:
Design resolution: 200 x 640 (W x H)
Fit Height selected
Fit Width not selected
Preview Resolution: 360 x 640 (WxH)
I get the same result on the preview as if Fit Width has been selected - the canvas content fitted all of the screen although I expected black borders at the sides of the screen as width shouldn’t be scaled.
Is this how it is supposed to be? if not, what am I missing?
I even tried manually setting this in script in the onLoad function:
cc.view.setDesignResolutionSize(640, 200, cc.ResolutionPolicy.FIXED_WIDTH);
But there wasn’t any difference.