Any Key

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Felipe Budinich
Citizen
Posts: 67
Joined: Thu Jul 29, 2010 1:36 pm

Re: Any Key

Post by Felipe Budinich »

bartbes wrote:Wow.
Thanks for developing an animation library that is so easy to use with prerendered 3d assets :-)
pekka
Party member
Posts: 206
Joined: Thu Jan 07, 2010 6:48 am
Location: Oulu, Finland
Contact:

Re: Any Key

Post by pekka »

Counting pressed keys fails badly if you use love.keyboard.setKeyRepeat to enable key repeating. You can see what happens when you run this program and hold down various keys for a while.

Code: Select all

love.keyboard.setKeyRepeat(100, 10)
keysdown = 0

function love.keypressed(key, unicode)
    keysdown = keysdown + 1
end

function love.keyreleased(key)
    keysdown = keysdown - 1
end

function love.draw()
	love.graphics.print("You are holding down " .. keysdown .. " keys",
		300, 300)
end
Post Reply

Who is online

Users browsing this forum: No registered users and 61 guests