Difference between revisions of "love.focus"

m
m
Line 36: Line 36:
 
[[Category:Callbacks]]
 
[[Category:Callbacks]]
 
{{#set:Description=Callback function triggered when window receives or loses focus.}}
 
{{#set:Description=Callback function triggered when window receives or loses focus.}}
 +
{{#set:Subcategory=General}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|love.focus}}
 
{{i18n|love.focus}}

Revision as of 06:59, 31 October 2013

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 not f then
    text = "UNFOCUSED!!"
    print("LOST FOCUS")
  else
    text = "FOCUSED!"
    print("GAINED FOCUS")
  end
end

See Also


Other Languages