Difference between revisions of "love.window.getPixelScale"
(Created page) |
m (0.11.0 -> 11.0) |
||
(9 intermediate revisions by one other user not shown) | |||
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 | + | {{oldin|[[11.0]]|110|type=function|text=This function has been renamed to [[love.window.getDPIScale]]}} |
+ | Gets the DPI scale factor associated with the window. | ||
− | The | + | The pixel density inside the window might be greater (or smaller) than the "size" of the window. For example on a retina screen in Mac OS X with the <code>highdpi</code> [[love.window.setMode|window flag]] enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. <code>love.window.getPixelScale()</code> would return <code>2.0</code> in that case. |
+ | |||
+ | The [[love.window.fromPixels]] and [[love.window.toPixels]] functions can also be used to convert between units. | ||
+ | |||
+ | The <code>highdpi</code> window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled. | ||
== Function == | == Function == | ||
Line 13: | Line 18: | ||
=== Returns === | === Returns === | ||
{{param|number|scale|The pixel scale factor associated with the window.}} | {{param|number|scale|The pixel scale factor associated with the window.}} | ||
+ | |||
+ | == Notes == | ||
+ | The units of [[love.graphics.getWidth]], [[love.graphics.getHeight]], [[love.mouse.getPosition]], mouse events, [[love.touch.getPosition]], and touch events are always in terms of pixels. | ||
+ | |||
== 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}} |
Latest revision as of 13:12, 29 December 2018
Available since LÖVE 0.9.1 |
This function is not supported in earlier versions. |
Removed in LÖVE 11.0 |
This function has been renamed to love.window.getDPIScale. |
Gets the DPI scale factor associated with the window.
The pixel density inside the window might be greater (or smaller) than the "size" of the window. For example on a retina screen in Mac OS X with the highdpi
window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.window.getPixelScale()
would return 2.0
in that case.
The love.window.fromPixels and love.window.toPixels functions can also be used to convert between units.
The highdpi
window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled.
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, mouse events, love.touch.getPosition, and touch events are always in terms of pixels.
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info