CoronaSDK 2013.1115 | Released: 18 May 2013, 2:04am | What's New | Download Now
These docs are *very* out of date.
You will be redirected to the new docs in a few seconds.
If you are certain you want to see the old docs, click cancel.
Cancel | Continue to new docs
You will be redirected to the new docs in a few seconds.
If you are certain you want to see the old docs, click cancel.
Cancel | Continue to new docs
display.contentScaleX
Description:
The ratio between content pixel and screen pixel width.
This value will always be 1 unless your project's config.lua file specifies your content's height and width (see example below). Different scale modes (letterbox, zoomEven, and so forth) will result in different scale factors.
Syntax:
scalex = display.contentScaleX
Example:
-- main.lua scalex = display.contentScaleX scaley = display.contentScaleY -- display scale values print("scalex", "scaley", scalex, scaley)
-- config.lua application = { content = { width = 320, height = 480, scale = "letterbox" }, }
Sample output on various devices:
-- iPhone scale_x scale_y 1 1 -- iPhone 4 scale_x scale_y 0.5 0.5 -- Droid scale_x scale_y 0.66666668653488 0.66666668653488 -- iPad scale_x scale_y 0.46875 0.46875
Parameters:
Returns:
The ratio between content pixel and screen pixel width.
Remarks:
Supported on operating systems and platforms for build numbers shown:
- Mac OS X:Build 2010.243
- Windows:Build 2010.243
- iOS:Build 2010.243
- Android:Build 2010.243
Replies
Posted on Mon, 2013-02-04 08:53
#2
Thanks, we will make the changes on our new API docs page.
http://docs.coronalabs.com
These API pages are no longer valid.
Documentation needs to be updated.
Print statement shows: print("scalex", "scaley", scalex, scaley)
But output shows: scale_x scale_y 1 1
In output "scale_x" should be "scalex" and "scale_y" should be "scaley"