Changing the Window Size depend on the device's aspect ratio

Get help using Construct 2

Post » Mon Aug 15, 2016 8:37 pm

Hi

I have been working on a mobile game and made it in a way that it looks fit on all aspect ratios. However I don't know how to find the aspect ratio of the device the game is being played in, in order to change the Window Size.

Should I use: if (WindowHeight / WindowWidth == 16:9) then Set canvas size to 720 x 1280?
B
45
S
19
G
3
Posts: 102
Reputation: 4,598

Post » Tue Aug 16, 2016 12:02 am

This is what fullscreen does automatically.
Image ImageImage
B
168
S
50
G
163
Posts: 8,223
Reputation: 105,065

Post » Tue Aug 16, 2016 12:51 am

newt wrote:This is what fullscreen does automatically.

You mean I don't need to do anything?
B
45
S
19
G
3
Posts: 102
Reputation: 4,598

Post » Tue Aug 16, 2016 2:11 am

You make a game for a specific ratio, and set it to fullscreen.
It will scale properly if the device is of that ratio.
16x9 covers most devices, and is a middle ground between other ratios.
Image ImageImage
B
168
S
50
G
163
Posts: 8,223
Reputation: 105,065

Post » Tue Aug 16, 2016 4:33 am

Reference: https://www.scirra.com/tutorials/73/sup ... reen-sizes

Unless you are talking about device orientation for portrait/landscape modes, a simple comparison of which of window height and width is larger on a trigger once event should serve nicely.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303


Return to How do I....?

Who is online

Users browsing this forum: wizdigitech, Zamargo and 14 guests