Skip to content

Instantly share code, notes, and snippets.

@biomood
Created May 31, 2011 20:43
Show Gist options
  • Save biomood/1001246 to your computer and use it in GitHub Desktop.
Save biomood/1001246 to your computer and use it in GitHub Desktop.
Love2D code for seeing what key/joystick button is pressed
game = {}
game.button= ""
game.key = ""
function love.load()
success = love.graphics.setMode(320, 240, false, 0)
end
function love.update(dt)
end
function love.draw()
love.graphics.clear()
love.graphics.printf(game.button, 0, 0, 50, "left")
love.graphics.printf(game.key, 0, 50, 50, "left")
end
function love.joystickreleased(joystick, button)
game.button = button
end
function love.keyreleased(key)
game.key = key
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment