Code: Select all
function love.mousepressed(x, y, button)
text = "Mouse button is "..button
end
Code: Select all
function love.mousepressed(x, y, button)
text = "Mouse button is "..button
end
Are you talking about the using input tutorial? I gave it a spin and it worked ok...thought I am using a PC so I can't say if its due to the one button or not.But when I try to run the code in the tutorial (the code meant to only change the text when mouse button 1 is pressed)
Code: Select all
function love.load()
love.graphics.setFont(12)
text = "Nothing yet"
end
function love.update(dt)
if love.keyboard.isDown( " " ) then
text = "SPACE is being pressed!"
end
if love.mouse.isDown("r") then
text = "Mouse button right is pressed"
end
mouse_x = love.mouse.getX()
mouse_y = love.mouse.getY()
end
function love.draw()
love.graphics.print( text, 330, 300 )
love.graphics.print( "Mouse X: ".. mouse_x .. " Mouse Y: " .. mouse_y, 10, 20 )
end
function love.keypressed( key )
if key == "return" then
text = "RETURN is being pressed!"
end
if key == 'h' then
if love.mouse.isVisible() then
love.mouse.setVisible(false)
else
love.mouse.setVisible(true)
end
end
end
function love.keyreleased( key )
if key == "return" then
text = "RETURN has been released!"
end
end
if love.mouse.isDown("r") then
text = "Mouse button right is pressed"
end
function love.mousepressed(x, y, button)
if button == 'l' then
text = "Mouse button left is pressed at X:"..x.." Y: "..y
end
end
function love.mousereleased(x, y, button)
if button == 'l' then
text = "Mouse button left is released"
end
end
Users browsing this forum: Bing [Bot] and 9 guests