How get real screen size

Hi, i would like know how get real screen size and not content scaling box one.Thanks.

The way I make sure that I know exactly where the real centre of my screen is and how big it is, it to set the alignment to the top left of the device screen, scaling to letterbox and then get the actual width and height and calculate the centre.

In the config.lua I have:

application = { content = { width = 640, height = 960, scale = "letterbox", xAlign = "left", yAlign = "top", }, }

In my main.lua I have:

display.actualCenterX, display.actualCenterY = display.actualContentWidth\*.5, display.actualContentHeight\*.5

The actual dimensions are available via display.actualContentWidth and display.actualContentHeight  so those are used to calculate the real centre.

With this I can know where all four real corners are on any device and I can still use dynamic resolution images without worrying about specifics.

For non-standard screen ratios, the following can be very helpful: 

 screenUpperBorder = display.topStatusBarContentHeight + display.screenOriginY screenLowerBorder = display.actualContentHeight + display.screenOriginY

screenUpperBorder and screenLowerBorder are the actual edge of the visible screens, display.screenOriginY being the adjustment. 

Same rules apply along the X axis. 

PS: this is when not specifying xAlign = “left”, yAlign = “top” in the config. 

This article may be of help: http://docs.coronalabs.com/daily/guide/basics/configSettings/index.html#content-scaling

http://docs.coronalabs.com/daily/api/   -->

   http://docs.coronalabs.com/daily/api/library/display/index.html -->

      http://docs.coronalabs.com/daily/api/library/display/pixelHeight.html

      

      http://docs.coronalabs.com/daily/api/library/display/pixelWidth.html

The issue I find with the pixel sizes is that they don’t take into account dynamic resolution. actualContent_N_ does.

The way I make sure that I know exactly where the real centre of my screen is and how big it is, it to set the alignment to the top left of the device screen, scaling to letterbox and then get the actual width and height and calculate the centre.

In the config.lua I have:

application = { content = { width = 640, height = 960, scale = "letterbox", xAlign = "left", yAlign = "top", }, }

In my main.lua I have:

display.actualCenterX, display.actualCenterY = display.actualContentWidth\*.5, display.actualContentHeight\*.5

The actual dimensions are available via display.actualContentWidth and display.actualContentHeight  so those are used to calculate the real centre.

With this I can know where all four real corners are on any device and I can still use dynamic resolution images without worrying about specifics.

For non-standard screen ratios, the following can be very helpful: 

 screenUpperBorder = display.topStatusBarContentHeight + display.screenOriginY screenLowerBorder = display.actualContentHeight + display.screenOriginY

screenUpperBorder and screenLowerBorder are the actual edge of the visible screens, display.screenOriginY being the adjustment. 

Same rules apply along the X axis. 

PS: this is when not specifying xAlign = “left”, yAlign = “top” in the config. 

This article may be of help: http://docs.coronalabs.com/daily/guide/basics/configSettings/index.html#content-scaling

http://docs.coronalabs.com/daily/api/   -->

   http://docs.coronalabs.com/daily/api/library/display/index.html -->

      http://docs.coronalabs.com/daily/api/library/display/pixelHeight.html

      

      http://docs.coronalabs.com/daily/api/library/display/pixelWidth.html

The issue I find with the pixel sizes is that they don’t take into account dynamic resolution. actualContent_N_ does.