Skip to main content

love.keyboard.setKeyRepeat

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.
Enables key repeating and sets the delay and interval.

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.
Hold left or right to change the position.
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

Removed in LÖVE 0.9.0
This example is not supported in that and later versions.
Hold left or right to continue moving. Please note that a generally better way to move an object would be to put code in love.update() which uses love.keyboard.isDown. This is just an example.
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

See Also



Other Languages

Comments

Popular posts from this blog

THEVARAM

Taluk Name : Uttamapalaiyam District : Theni State : Tamil Nadu Language : Tamil Time zone: IST (UTC+5:30) Elevation / Altitude: 345 meters. Above Seal level Telephone Code / Std Code: 04554 Pin Code : 625530 Post Office Name : Thevaram correct Pin Code,if wrong Main Village Name : Thevaram About Thevaram Thevaram is a small Village/hamlet in Uttamapalaiyam Taluk in Theni District of Tamil Nadu State, India. It comes under Thevaram Panchayath. It is located 32 KM towards South from District head quarters Theni. 563 KM from State capital Chennai Thevaram Pin code is 625530 and postal head office is Thevaram . Thevaram is surrounded by Chinnamanur Taluk towards East , Kambam Taluk towards South , Kadamalaikundru Myladumparai Taluk towards East , Nedumkandom Taluk towards west . Uthamapalayam , Theni Allinagaram , Periyakulam , Srivilliputhur are the nearby Cities to Thevaram. Demographics of Thevaram Tamil is the Local Language here. HOW TO REACH Thevaram By Ra...

FRIENDSHIP

Friendship Poems short cute Poems about Friendship BEST FRIENDS POEMS      INSPIRATIONAL FRIENDSHIP POEMS       SWEET FRIENDSHIP POEMS           SHORT INSPIRING STORIES      FRIENDSHIP QUOTES     BABY PICTURES & CUTE STUFF      FRIENDSHIP FOR GRANTED      SMS MESSAGES ON FRIENDSHIP   Friendship poems & poetry : A friend is like a flower, a rose to be exact, Or maybe like a brand new gate that never comes unlatched. A friend is like an owl, both beautiful and wise. Or perhaps a friend is like a ghost, whose spirit never dies. A friend is like a heart that goes strong until the end. Where would we be in this world if we didn't have a friend. - By Adrianne S Best Friend Poems and Quotes Friends at school Are big and small. Friends at school Are best of all! ...

The Coldest Winter I Ever Spent Was a Summer in San Francisco

The Coldest Winter I Ever Spent Was a Summer in San Francisco Posted on November 30, 2011 Locale: San Francisco, California? Paris, France? Duluth, Minnesota? Milwaukee, Wisconsin? Originator: Mark Twain? Horace Walpole? James Quin? R. Q. Grant? Lord Byron? Anonymous? Dear Quote Investigator : Living in Menlo Park near San Francisco I have heard the following witticism credited to Mark Twain many times: The coldest winter I ever spent was a summer in San Francisco. The coldest winter I ever saw was the summer I spent in San Francisco. I actually enjoy the weather here, so this saying always seemed implausible to me. Also, the San Francisco Chronicle once printed an article that cast doubt on the Twain attribution. Can you figure out who created this joke? Also, was the remark originally about SF or some other locale? Quote Investigator : There is no evidence in the papers and speeches of Mark Twain that he ever made this remark about San Franc...