Difference between revisions of "love.mouse.isDown"

m (RM old example)
m
Line 10: Line 10:
 
{{param|boolean|down|True if the specified button is down.}}
 
{{param|boolean|down|True if the specified button is down.}}
 
== Function ==
 
== Function ==
{{newin|[[0.7.2]]|type=variant}}
+
{{newin|[[0.7.2]]|072|type=variant}}
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">

Revision as of 13:51, 4 May 2012

Checks whether a certain mouse button is down.

Function

Synopsis

down = love.mouse.isDown( button )

Arguments

MouseConstant button
The button to check.

Returns

boolean down
True if the specified button is down.

Function

Available since LÖVE 0.7.2
This variant is not supported in earlier versions.

Synopsis

anyDown = love.mouse.isDown( button1, button2, button3, ... )

Arguments

MouseConstant buttonN
A button to check.

Returns

boolean anyDown
True if any specified button is down, false otherwise.

Example

Increase a value while the right mouse button is held

val = 0   -- establish a variable for later use
function love.update(dt)
	if love.mouse.isDown("r") then
		val = val + dt   -- we will increase the variable by 1 for every second the button is held down
	end	
end

See Also


Other Languages