Hello everyone! So I followed some tutorials where there was a function Mousepressed, but this function I think is deleted and it's not mentioned in the wiki!:)
I am new to Love2D and I saw one change here: KeyPressed to textinput. So I can't get the input work with textinput, maybe some of you could give me a simple example of user input using textinput function?
Mousepressed and Keypressed=> TextInput
-
- Citizen
- Posts: 56
- Joined: Wed Feb 27, 2013 7:53 pm
- SneakySnake
- Citizen
- Posts: 94
- Joined: Fri May 31, 2013 2:01 pm
- Contact:
Re: Mousepressed and Keypressed=> TextInput
It wasn't deleted. It still exists.TheScriptan wrote:So I followed some tutorials where there was a function Mousepressed, but this function I think is deleted and it's not mentioned in the wiki!:)
textinput is not a replacement of keypressed. keypressed still exists.TheScriptan wrote:I am new to Love2D and I saw one change here: KeyPressed to textinput.
LÖVE 0.9.1 code
Code: Select all
local log = {}
function love.load()
love.keyboard.setKeyRepeat(true)
end
function love.mousepressed(x, y, button)
table.insert(log, string.format("Mouse button %s pressed at %s, %s", button, x, y))
end
function love.keypressed(key, isrepeat)
local r = isrepeat and "It's a repeat" or "Not a repeat"
table.insert(log, string.format("Key %s pressed, %s", key, r))
end
function love.draw()
for i, v in ipairs(log) do
love.graphics.print(v, 0, (i - 1) * love.graphics.getFont():getHeight())
end
end
-
- Citizen
- Posts: 56
- Joined: Wed Feb 27, 2013 7:53 pm
Re: Mousepressed and Keypressed=> TextInput
EDIT:
Sorry, I didn't notice that there is a variable in keypressed function that is required! Thank you for the information!
Sorry, I didn't notice that there is a variable in keypressed function that is required! Thank you for the information!
Who is online
Users browsing this forum: No registered users and 2 guests