I can see that the display library provides pixelHeight, contentHeight, viewableContentHeight, and actualContentHeight (along with their width equivalents), but none of these values seem to provide the actual dimensions of the current hardware. I’ve even tried the width and height properties of display.currentStage. I’ve been testing these options by setting the width and height of a background rectangle to those exact values, but there’s always either black bars or cropping. Is there any way to figure out how big the screen actually is rather than just guessing at how much bleed area you should accommodate? I want to be able to scale the layout of my content according to the actual size of the screen and not be confined by the aspect ratio defined by config.lua.
Okay, after further testing, I think actualContentWidth and actualContentHeight are what I’m looking for. The cropping I was experiencing had to do with a typo in my code.
The physical dimensions of the screen (in pixels) are provided by display.pixelWidth and display.pixelHeight.
For instance, if your device is a Samsung S7, these values are 1440 and 2560.
display.contentWidth/Height are taken from your configuration file config.lua
display.actualContentWidth/Height are computed according to display.contentWidth/Height and the real screen ratio of your device.
Okay, but if you set the dimensions of a display object to 1440x2560 on a Samsung S7 for example, the display object will be much larger than the screen (presumably only when the content dimensions are smaller in config.lua). I’m guessing there’s some scaling applied to the content as though it’s all contained in a scaled display group. Is there a way to check the actual value of the scale?
You shouldn’t need to worry about pixel dimensions with Corona. You define the content area you want to work with, Corona takes care of the rest of it for you.
Rob
Okay, after further testing, I think actualContentWidth and actualContentHeight are what I’m looking for. The cropping I was experiencing had to do with a typo in my code.
The physical dimensions of the screen (in pixels) are provided by display.pixelWidth and display.pixelHeight.
For instance, if your device is a Samsung S7, these values are 1440 and 2560.
display.contentWidth/Height are taken from your configuration file config.lua
display.actualContentWidth/Height are computed according to display.contentWidth/Height and the real screen ratio of your device.
Okay, but if you set the dimensions of a display object to 1440x2560 on a Samsung S7 for example, the display object will be much larger than the screen (presumably only when the content dimensions are smaller in config.lua). I’m guessing there’s some scaling applied to the content as though it’s all contained in a scaled display group. Is there a way to check the actual value of the scale?
You shouldn’t need to worry about pixel dimensions with Corona. You define the content area you want to work with, Corona takes care of the rest of it for you.
Rob