How to get text input and displaying it?
Posted: Mon May 20, 2013 8:44 pm
I understand the concept on how to get input, but the way I was thinking of doing it (and it works, may I add) was very inefficient. Heres a sample:
This, I'm sure, is a very bad way of doing it. And if you had to enter a name for a save file and had to put that in like 5 times if you had a limit of 5 letters? That would be ridiculous. I saw a library called 'TextInput', but it was for 0.7.X. If you know about that library, could you maybe tell me if it still works for 0.8.0 or if there is an updated version of it? Is there another library like it? Is there a solution? The above code was the only solution I can think of.
Any help is appreciated! I've gotten a lot of help from people on this forum, so hopefully my luck continues
Code: Select all
function love.load()
text = ""
end
function love.update()
end
function love.draw()
love.graphics.print(text, 100, 10)
end
function love.keypressed(key)
if key == "a" or "b" or "c" then -- and so on
text = key
end
end
Any help is appreciated! I've gotten a lot of help from people on this forum, so hopefully my luck continues