Difference between revisions of "love.window.getDesktopDimensions (简体中文)"

(english -> 简体中文)
 
m (修改 父节点)
Line 25: Line 25:
  
 
== 参见 ==
 
== 参见 ==
* [[parent::love.window_(简体中文)]]
+
* [[parent::love.window (简体中文)]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
{{#set:Description=获取桌面(显示器)的宽和高)}}
 
{{#set:Description=获取桌面(显示器)的宽和高)}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|love.window.getDesktopDimensions}}
 
{{i18n|love.window.getDesktopDimensions}}

Revision as of 14:31, 9 March 2018

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

获取桌面(显示器)的宽和高

函数

基础使用

width, height = love.window.getDesktopDimensions( display )

参数

number display (1)
显示器的编号,用于拥有多个显示器时

返回值

number width
桌面的宽
number height
桌面的高

示例

输出当前窗口所在显示器的分辨率

function love.draw()
    local _, _, flags = love.window.getMode()

    -- 当前窗口的flags(table)值中包含了当前所在显示器的编号
    local width, height = love.window.getDesktopDimensions(flags.display)

    love.graphics.print(("display %d: %d x %d"):format(flags.display, width, height), 4, 10)
end

参见

Other Languages