love.mousefocus

love.mousefocus

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

1
love.mousefocus( focus )

Arguments

boolean focus
Wether the window has mouse focus or not.

Returns

Nothing.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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


doc_love
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.