Difference between revisions of "love.window.getPixelScale"

m
m
Line 1: Line 1:
 
{{newin|[[0.9.1]]|091|type=function}}
 
{{newin|[[0.9.1]]|091|type=function}}
Gets the scale factor associated with the window. In Mac OS X with the window in a retina screen and the <code>highdpi</code> window flag enabled this will be 2.0, otherwise it will be 1.0.
+
Gets the DPI scale factor associated with the window. In Mac OS X with the window in a retina screen and the <code>highdpi</code> window flag enabled this will be 2.0, otherwise it will be 1.0.
  
 
The scale factor is used to display graphics at a size the user is expecting, rather than the size of the pixels.  On retina displays with the <code>highdpi</code> window flag enabled, the pixels in the window are 2x smaller than the scale of the normal content on the screen, so [[love.window.getPixelScale]] will return 2.
 
The scale factor is used to display graphics at a size the user is expecting, rather than the size of the pixels.  On retina displays with the <code>highdpi</code> window flag enabled, the pixels in the window are 2x smaller than the scale of the normal content on the screen, so [[love.window.getPixelScale]] will return 2.
Line 19: Line 19:
 
== See Also ==
 
== See Also ==
 
* [[parent::love.window]]
 
* [[parent::love.window]]
 +
* [[love.window.toPixels]]
 +
* [[love.window.fromPixels]]
 
* [[love.window.setMode]]
 
* [[love.window.setMode]]
 
* [[Config Files]]
 
* [[Config Files]]
  
 
[[Category:Functions]]
 
[[Category:Functions]]
{{#set:Description=Gets the scale factor associated with the window.}}
+
{{#set:Description=Gets the DPI scale factor associated with the window.}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|love.window.getPixelScale}}
 
{{i18n|love.window.getPixelScale}}

Revision as of 03:39, 9 February 2015

Available since LÖVE 0.9.1
This function is not supported in earlier versions.

Gets the DPI scale factor associated with the window. In Mac OS X with the window in a retina screen and the highdpi window flag enabled this will be 2.0, otherwise it will be 1.0.

The scale factor is used to display graphics at a size the user is expecting, rather than the size of the pixels. On retina displays with the highdpi window flag enabled, the pixels in the window are 2x smaller than the scale of the normal content on the screen, so love.window.getPixelScale will return 2.

Function

Synopsis

scale = love.window.getPixelScale( )

Arguments

None.

Returns

number scale
The pixel scale factor associated with the window.

Notes

The units of love.graphics.getWidth, love.graphics.getHeight, love.mouse.getPosition, and mouse events are always in terms of pixels.

See Also

Other Languages