Difference between revisions of "love.graphics.getWidth"

(Add link to getDimensions.)
(Function)
Line 10: Line 10:
 
=== Returns ===
 
=== Returns ===
 
{{param|number|width|The width of the window.}}
 
{{param|number|width|The width of the window.}}
 +
=== Example ===
 +
<source lang="lua">
 +
function love.load()
 +
    image = love.graphics.newImage("MyImage.png")
 +
    width = image:getWidth()
 +
end
 +
</source>
 +
 
== See Also ==
 
== See Also ==
 
* [[parent::love.graphics]]
 
* [[parent::love.graphics]]

Revision as of 00:24, 12 July 2020

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

Gets the width in pixels of the window.

Function

Synopsis

width = love.graphics.getWidth( )

Arguments

None.

Returns

number width
The width of the window.

Example

function love.load()
    image = love.graphics.newImage("MyImage.png")
    width = image:getWidth()
end

See Also


Other Languages