Scale canvas to fit in container

Hi…

as you know the game canvas resizes as per window width and height by keeping aspect ratio.
If suppose I have a div container of dimensions 600x600 then how I can fit the game canvas in that div.

I want game canvas to maximize up to the certain dimensions not more than It

I guess the easyest way would be to load your game inside an iframe element of another html file and set the size of the iframe like so:

[code]

[/code] Instead of "width=" and "height=" you could also use css "max-width" and "max-height" for the iframe.

The fullscreen action has an option to keep the aspect ratio, try to launch the action with this option disabled :slight_smile:

iFRAME can fix the problem but it causes problem and not a good way to lock the canvas size.

Also I have tried the aspect ratio of full screen that also does not works

I have developed the game in 320x480 gdevelop automatically scale it up and down by keeping the aspect ratio

I need for example 384x487 resolution. game should not scaleup from that resolution but can scale down

I got my game to fit on multiple devices perfectly by using the “Activate Fullscreen” and setting aspect ratio off at the start of the scene. All my scenes are 940x640 but I think certain devices and sizes get a few pixels cut off :\