Difference between revisions of "love.focus"
(Example love.focus usage.) |
|||
Line 11: | Line 11: | ||
=== Returns === | === Returns === | ||
Nothing. | Nothing. | ||
+ | == Example == | ||
+ | <source lang="lua"> | ||
+ | |||
+ | 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 | ||
+ | |||
+ | </source> | ||
== See Also == | == See Also == | ||
* [[parent::love]] | * [[parent::love]] |
Revision as of 20:05, 14 November 2010
Available since LÖVE 0.7.0 |
It 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
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info