-
-
Save hamzamu/778ac0d1f326b1d7ee80bbb4c6c4d7f6 to your computer and use it in GitHub Desktop.
Love2D code for seeing what key/joystick button is pressed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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