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?
Develop games in your browser. Powerful, performant & highly capable.
This is what fullscreen does automatically.
You mean I don't need to do anything?
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.
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.