I am just testing out Cocos Creator for a potential project, but I seem to be stuck on the first thing I’ve tried to do.
I want after a build, that the GameCanvas will scale to the available window width and height (no aspect ratio constraints).
So for example, if the window is 1000x300 i want the GameCanvas to be 1000x300 pixels in size.
I want the GameCanvas to display an image stretched to the exact size of the GameCanvas.
So I created a new scene with a canvas element which is 1920x1800. I then added a widget to this canvas element with a target as the scene and set the widget to horizontal stretch and vertical stretch.
I then added a sprite that is comprised of an image at 1920x1080 to the canvas. I then add a widget to this sprite with the target being the canvas (its parent). I also set this widget’s horizontal and vertical stretch to be full.
I assumed this would make the game canvas the size of the screen, and then the sprite the size of the canvas. However, when building the game this is not what i see. The game canvas does not resize to the screen size (it seems slightly off) and the bitmap image does alter in size but doesn’t appear to fit the canvas properly.
Can anybody tell me what I am doing wrong, or tell me how to set up a very basic project to simply have a background image fill the whole of the canvas, irrespective of aspect ratio(i.e. the image will be disported if the canvas isn’t the same aspect ratio as the image)?
thanks for any help or guidance