Difference between revisions of "love.wheelmoved"

(Created page)
 
m (Examples)
Line 17: Line 17:
 
function love.wheelmoved(x, y)
 
function love.wheelmoved(x, y)
 
     if y > 0 then
 
     if y > 0 then
         text = "Mouse wheel moved upward"
+
         text = "Mouse wheel moved up"
 
     elseif y < 0 then
 
     elseif y < 0 then
         text = "Mouse wheel moved downward"
+
         text = "Mouse wheel moved down"
 
     end
 
     end
 
end
 
end
Line 27: Line 27:
 
end
 
end
 
</source>
 
</source>
 +
 
== See Also ==
 
== See Also ==
 
* [[parent::love]]
 
* [[parent::love]]

Revision as of 14:39, 30 May 2015

Available since LÖVE 0.10.0
This function is not supported in earlier versions.

Callback function triggered when the mouse wheel is moved.

Function

Synopsis

love.wheelmoved( x, y )

Arguments

number x
Amount of horizontal mouse wheel movement. Positive values indicate movement to the right.
number y
Amount of vertical mouse wheel movement. Positive values indicate upwards movement.

Returns

Nothing.

Examples

local text = ""

function love.wheelmoved(x, y)
    if y > 0 then
        text = "Mouse wheel moved up"
    elseif y < 0 then
        text = "Mouse wheel moved down"
    end
end

function love.draw()
    love.graphics.print(text, 10, 10)
end

See Also


Other Languages