Difference between revisions of "love.mouse.isVisible"

m
(Add an example, see also)
 
(One intermediate revision by one other user not shown)
Line 9: Line 9:
 
=== Returns ===
 
=== Returns ===
 
{{param|boolean|visible|True if the cursor to visible, false if the cursor is hidden.}}
 
{{param|boolean|visible|True if the cursor to visible, false if the cursor is hidden.}}
 +
== Examples ==
 +
Toggle mouse visibility by pressing tab (using [[love.mouse.setVisible|setVisible]]).
 +
<source lang="lua">
 +
function love.keypressed(key)
 +
  if key == "tab" then
 +
      local state = not love.mouse.isVisible()  -- the opposite of whatever it currently is
 +
      love.mouse.setVisible(state)
 +
  end
 +
end
 +
</source>
 
== See Also ==
 
== See Also ==
 
* [[parent::love.mouse]]
 
* [[parent::love.mouse]]
 +
* [[love.mouse.setVisible]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
{{#set:Description=Checks if the cursor is visible.}}
 
{{#set:Description=Checks if the cursor is visible.}}
 +
{{#set:Since=000}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|love.mouse.isVisible}}
 
{{i18n|love.mouse.isVisible}}

Latest revision as of 13:56, 27 September 2011

Checks if the cursor is visible.

Function

Synopsis

visible = love.mouse.isVisible( )

Arguments

None.

Returns

boolean visible
True if the cursor to visible, false if the cursor is hidden.

Examples

Toggle mouse visibility by pressing tab (using setVisible).

function love.keypressed(key)
   if key == "tab" then
      local state = not love.mouse.isVisible()   -- the opposite of whatever it currently is
      love.mouse.setVisible(state)
   end
end

See Also


Other Languages