Difference between revisions of "love.system.setClipboardText (简体中文)"
Xcantloadx (talk | contribs) (Created page with "{{newin|0.9.0|090|type=function}} 设置剪贴板的文本。 == 函数 == === 概要 === <source lang="lua"> love.system.setClipboardText( text ) </source> === 参数 ==...") |
Xcantloadx (talk | contribs) m (修改 newin 模板为中文) |
||
Line 1: | Line 1: | ||
− | {{newin|[[0.9.0]]|090|type= | + | {{newin (简体中文)|[[0.9.0]]|090|type=函数}} |
设置剪贴板的文本。 | 设置剪贴板的文本。 | ||
Latest revision as of 11:37, 11 July 2019
自 LÖVE 0.9.0 可以使用 |
此 函数 在早期版本中不受支持. |
设置剪贴板的文本。
函数
概要
love.system.setClipboardText( text )
参数
string text
- 要保存在剪贴板中的新文本。
返回值
无返回值。
例子
自定义非系统级的复制/粘贴热键(仅在游戏窗口内有效)
local buffer
function love.draw()
love.graphics.print(
"OS: "..love.system.getOS().."\n"..
"Local buffer: "..tostring(buffer).."\n"..
"System buffer: "..tostring(love.system.getClipboardText()))
end
function love.keypressed(key)
local osString = love.system.getOS()
local control
if osString == "OS X" then
control = love.keyboard.isDown("lgui","rgui")
elseif osString == "Windows" or osString == "Linux" then
control = love.keyboard.isDown("lctrl","rctrl")
end
if control then
if key == "c" then
if buffer then love.system.setClipboardText(buffer) end
end
if key == "v" then
buffer = love.system.getClipboardText()
end
end
end
参考
其他语言
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