Difference between revisions of "love.window.getDesktopDimensions"
m |
(Added example) |
||
Line 11: | Line 11: | ||
{{param|number|width|The width of the desktop.}} | {{param|number|width|The width of the desktop.}} | ||
{{param|number|height|The height of the desktop.}} | {{param|number|height|The height of the desktop.}} | ||
+ | == Examples == | ||
+ | === Show the resolution of the monitor the window is currently in === | ||
+ | <source lang="lua"> | ||
+ | function love.draw() | ||
+ | local _, _, flags = love.window.getMode() | ||
+ | |||
+ | -- The window's flags contain the index of the monitor it's currently in. | ||
+ | local desktop_w, desktop_h = love.window.getDesktopDimensions(flags.display) | ||
+ | |||
+ | love.graphics.print(("display %d: %d x %d"):format(flags.display, desktop_w, desktop_h), 4, 10) | ||
+ | end | ||
+ | </source> | ||
+ | |||
== See Also == | == See Also == | ||
* [[parent::love.window]] | * [[parent::love.window]] |
Revision as of 02:16, 31 October 2013
Available since LÖVE 0.9.0 |
This function is not supported in earlier versions. |
Gets the width and height of the desktop.
Contents
Function
Synopsis
width, height = love.window.getDesktopDimensions( display )
Arguments
number display (1)
- The index of the display, if multiple monitors are available.
Returns
Examples
Show the resolution of the monitor the window is currently in
function love.draw()
local _, _, flags = love.window.getMode()
-- The window's flags contain the index of the monitor it's currently in.
local desktop_w, desktop_h = love.window.getDesktopDimensions(flags.display)
love.graphics.print(("display %d: %d x %d"):format(flags.display, desktop_w, desktop_h), 4, 10)
end
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