Difference between revisions of "love.graphics.getPixelWidth"

m
m
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{newin|[[0.11.0]]|110|type=function}}
+
{{newin|[[11.0]]|110|type=function}}
 
Gets the width in pixels of the window.
 
Gets the width in pixels of the window.
  
The graphics coordinate system and [[love.graphics.getWidth]] use units scaled by the screen's [[love.graphics.getDPIScale|DPI scale factor]], rather than raw pixels. Use getWidth for calculations related to drawing and using the coordinate system (calculating the center of the screen, for example), and getPixelWidth only when dealing specifically with underlying pixels (pixel-related calculations in a pixel [[Shader]], for example).
+
The graphics coordinate system and [[love.graphics.getWidth]] use units scaled by the screen's [[love.graphics.getDPIScale|DPI scale factor]], rather than raw pixels. Use getWidth for calculations related to drawing to the screen and using the coordinate system (calculating the center of the screen, for example), and getPixelWidth only when dealing specifically with underlying pixels (pixel-related calculations in a pixel [[Shader]], for example).
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===

Latest revision as of 03:13, 19 July 2019

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

Gets the width in pixels of the window.

The graphics coordinate system and love.graphics.getWidth use units scaled by the screen's DPI scale factor, rather than raw pixels. Use getWidth for calculations related to drawing to the screen and using the coordinate system (calculating the center of the screen, for example), and getPixelWidth only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example).

Function

Synopsis

pixelwidth = love.graphics.getPixelWidth( )

Arguments

None.

Returns

number pixelwidth
The width of the window in pixels.

See Also


Other Languages