love.keyboard.setKeyRepeat
Enables or disables key repeat. It is disabled by default.Function
Available since LÖVE 0.9.0 |
This variant is not supported in earlier versions. |
Synopsis
love.keyboard.setKeyRepeat( enable )
Arguments
boolean enable
- Whether repeat keypress events should be enabled when a key is held down.
Returns
Nothing.Notes
The interval between repeats depends on the user's system settings.Function
Removed in LÖVE 0.9.0 |
This variant is not supported in that and later versions. |
Synopsis
love.keyboard.setKeyRepeat( delay, interval )
Arguments
number delay
- The amount of time before repeating the key (in seconds). 0 disables key repeat.
number interval
- The amount of time between repeats (in seconds)
Returns
Nothing.Examples
Available since LÖVE 0.9.0 |
This example is not supported in earlier versions. |
function love.load()
love.keyboard.setKeyRepeat(true)
x = 50
end
function love.keypressed(key, isrepeat)
if key == "right" then
x = (x + 80) % love.graphics.getWidth()
elseif key == "left" then
x = (x - 80) % love.graphics.getWidth()
end
end
function love.draw()
love.graphics.circle("fill", x, 100)
end
love.keyboard.setKeyRepeat(true)
x = 50
end
function love.keypressed(key, isrepeat)
if key == "right" then
x = (x + 80) % love.graphics.getWidth()
elseif key == "left" then
x = (x - 80) % love.graphics.getWidth()
end
end
function love.draw()
love.graphics.circle("fill", x, 100)
end
Removed in LÖVE 0.9.0 |
This example is not supported in that and later versions. |
function love.load()
x = 400
love.keyboard.setKeyRepeat(0.01, 0.2)
end
function love.keypressed(key)
if key == "left" then
x = x - 20
elseif key == "right" then
x = x + 20
end
end
function love.draw()
love.graphics.circle("fill", x, 300, 30, 30)
end
x = 400
love.keyboard.setKeyRepeat(0.01, 0.2)
end
function love.keypressed(key)
if key == "left" then
x = x - 20
elseif key == "right" then
x = x + 20
end
end
function love.draw()
love.graphics.circle("fill", x, 300, 30, 30)
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
More info
Comments