Difference between revisions of "love.window.setFullscreen"
m (Descriptions of return values are no longer ambiguous. I read the source code on bitbucket, this is correct.) |
m (→Examples: - Fix the second example.) |
||
(One intermediate revision by one other user not shown) | |||
Line 30: | Line 30: | ||
function love.load() | function love.load() | ||
love.window.setFullscreen(true, "desktop") | love.window.setFullscreen(true, "desktop") | ||
+ | end | ||
+ | </source> | ||
+ | |||
+ | Make the window fullscreen in exclusive mode and back on F11: | ||
+ | <source lang="lua"> | ||
+ | function love.keypressed(key, scancode, isrepeat) | ||
+ | if key == "f11" then | ||
+ | fullscreen = not fullscreen | ||
+ | love.window.setFullscreen(fullscreen, "exclusive") | ||
+ | end | ||
end | end | ||
</source> | </source> |
Latest revision as of 21:48, 17 July 2022
Available since LÖVE 0.9.0 |
This function is not supported in earlier versions. |
Enters or exits fullscreen. The display to use when entering fullscreen is chosen based on which display the window is currently in, if multiple monitors are connected.
Contents
Function
Synopsis
success = love.window.setFullscreen( fullscreen )
Arguments
boolean fullscreen
- Whether to enter or exit fullscreen mode.
Returns
boolean success
- True if an attempt to enter fullscreen was successful, false otherwise.
Function
Synopsis
success = love.window.setFullscreen( fullscreen, fstype )
Arguments
boolean fullscreen
- Whether to enter or exit fullscreen mode.
FullscreenType fstype
- The type of fullscreen mode to use.
Returns
boolean success
- True if an attempt to enter fullscreen was successful, false otherwise.
Notes
If fullscreen mode is entered and the window size doesn't match one of the monitor's display modes (in normal fullscreen mode) or the window size doesn't match the desktop size (in 'desktop' fullscreen mode), the window will be resized appropriately. The window will revert back to its original size again when fullscreen mode is exited using this function.
Examples
Make the window fullscreen in desktop mode.
function love.load()
love.window.setFullscreen(true, "desktop")
end
Make the window fullscreen in exclusive mode and back on F11:
function love.keypressed(key, scancode, isrepeat)
if key == "f11" then
fullscreen = not fullscreen
love.window.setFullscreen(fullscreen, "exclusive")
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