Cocos Creator Resolution Problem

Hello,

When i set design policy to 800 x 1280 and use 800 x 1280 image not fill all screen. How can achive fill all screen with my image?

Thanks,
isa can

var policy = new cc.ResolutionPolicy(cc.ContainerStrategy.EQUAL_TO_FRAME, cc.ContentStrategy.EXACT_FIT)

cc.view.setDesignResolutionSize(800, 1200, cc.ResolutionPolicy);

Where would you place that code?
Would it be in a script attached to the canvas node inside the onLoad function?

Hello i try in onLoad method but it occures:

Simulator : TypeError: cc.ContainerStrategy is undefined
at a: “var policy = new cc.ResolutionPolicy(cc.ContainerStrategy.EQUAL_TO_FRAME,” (assets/Script/Main.js:18:8)

set the size of the canvas component to that…

i set size of canvas 800 x 1280 but same result.

Can u plz make a dummy project and upload the projct for us to see?

1 Like

Hi,

The resolution does not work for me either. It seems it does not work in FireFox.
I set design resolution to 768x1024 for canvas, added 4 labels at the corners, created the script and added the code that I used in main.js of cocos2dx-js v 3.10.

cc.view.setResolutionPolicy(cc.ResolutionPolicy.SHOW_ALL);
cc.view.adjustViewPort(true);
cc.view.resizeWithBrowserSize(true);

Result: bottom labels at their places, but there are no upper labels.

Could you help?

NOTE: I moved labels inside Canvas at the NodeTree, but this did not help.

Regards,
Valery.
testresolution.zip (127.6 KB)