Difference between revisions of "love.mousefocus"

m
m
Line 7: Line 7:
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|boolean|focus|Wether the window has mouse focus or not.}}
+
{{param|boolean|focus|Whether the window has mouse focus or not.}}
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.

Revision as of 09:56, 17 August 2017

Available since LÖVE 0.9.0
This callback is not supported in earlier versions.

Callback function triggered when window receives or loses mouse focus.

Function

Synopsis

love.mousefocus( focus )

Arguments

boolean focus
Whether the window has mouse focus or not.

Returns

Nothing.

Example

function love.load()
  text = "Mouse is in the window!"
end

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

function love.mousefocus(f)
  if not f then
    text = "Mouse is not in the window!"
    print("LOST MOUSE FOCUS")
  else
    text = "Mouse is in the window!"
    print("GAINED MOUSE FOCUS")
  end
end

See Also


Other Languages