Detect Phone's Aspect Ratio?

Wasanni

  • *
  • Posts: 121
Is it possible to detect a phone's aspect ratio and then change how the game scales depending on the aspect ratio?

I didn't see any blocks for aspect ratio, only found game scaling and detecting iphone sizes. It would be really useful to make my app look good on 16:9 and 18:9 + (since most new devices are more rectangular)

« Last Edit: October 08, 2019, 05:37:47 pm by Wasanni »

NOTA

  • Posts: 218
In Stencyl Setting:
Stretch to fit,
Full screen,
Letter box,
Fill...

designpeg

  • *
  • Posts: 699
Hi, as per NOTA you can use those blocks to change the way your game is scaled.

You can use my extension to calculate  the device's screen ratio. The blocks return the actual size of the screen - so if you have a game in a browser it will return the width or height of the whole screen, not the browser screen, Obviously this won't matter for a phone or tablet.  Pixel ratio isn't much use, as most pixels are square.  There are a few other blocks you might find useful   eg. dpi  and device language blocks.

Wasanni

  • *
  • Posts: 121
Awesome! Thank you! Much appreciated :)