Difference between revisions of "love.mouse.setVisible"

m (1 revision: Importing from potato (again).)
(Add an example, see also)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
 
Sets the current visibility of the cursor.
 
Sets the current visibility of the cursor.
 
== Function ==
 
== Function ==
Line 10: Line 9:
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
 +
== Examples ==
 +
Toggle mouse visibility by pressing tab.
 +
<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.isVisible]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
{{#set:Description=Sets the current visibility of the cursor.}}
 
{{#set:Description=Sets the current visibility of the cursor.}}
 +
{{#set:Since=000}}
 +
== Other Languages ==
 +
{{i18n|love.mouse.setVisible}}

Latest revision as of 13:55, 27 September 2011

Sets the current visibility of the cursor.

Function

Synopsis

love.mouse.setVisible( visible )

Arguments

boolean visible
True to set the cursor to visible, false to hide the cursor.

Returns

Nothing.

Examples

Toggle mouse visibility by pressing tab.

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