The scale factor from above tells you how much the content is being scaled.
For example, let’s say that your content area is 960x640. If you’d run your app on devices with various screen sizes, you’d get:
- screen size = 960x640, scale factor = 1
- screen size = 960x580, scale factor = 0.90625
- screen size = 1136x640, scale factor = 1
- screen size = 1334x750, scale factor = 1.171875
- screen size = 2000x640, scale factor = 1
So, in this case, the moment that the screen gets wider or narrower, Solar2D starts to scale the display objects up or down depending on the scale factor.
These examples are from a landscape orientation, so if you were to multiply display.actualContentWidth
with the scale factor, you’d get the actual width of the screen in pixels, e.g. 960 x 1.171875 = 1334.
This also works in reverse, so if you know the pixel width or height of your device, you can use the scale factor to find out what the width or height would be in Solar2D content units.