Difference between revisions of "love.focus"

(Example)
m
Line 24: Line 24:
 
   if f then
 
   if f then
 
     print("Window is focused.")
 
     print("Window is focused.")
 +
    text = "FOCUSED"
 
   else
 
   else
 
     print("Window is not focused.")
 
     print("Window is not focused.")
 +
    text = "UNFOCUSED"
 
   end
 
   end
 
end
 
end

Revision as of 15:48, 2 July 2015

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

Callback function triggered when window receives or loses focus.

Function

Synopsis

love.focus( f )

Arguments

boolean f
Window focus

Returns

Nothing.

Example

function love.load()
  text = "FOCUSED"
end

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

function love.focus(f)
  if f then
    print("Window is focused.")
    text = "FOCUSED"
  else
    print("Window is not focused.")
    text = "UNFOCUSED"
  end
end

See Also


Other Languages