How to contral my game window size

How to contral my game window size
0.0 0


I don’t want my game size adapt the window size.
and I want my game window are always in the center of window.
I try to contral the

. but it doesn’t work. The canvas’s size are always the same as the window size



It’s because we use resolution policy by default, you can find cc.EGLView.getInstance().setDesignResolutionSize, and remove this line of code, then you can use css to configure your canvas

Or you can wrap your canvas into a div which is centered and sized in the document body.

For more details:



thank you