Difference between revisions of "love.displayrotated"
(Created page with "{{newin|11.3|113|type=callback}} Called when the device display orientation changed, for example, user rotated their phone 180 degrees. == Function == === Synopsis === <s...") |
m (Move subcategory to Window.) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{newin|[[11.3]]|113|type=callback}} | {{newin|[[11.3]]|113|type=callback}} | ||
Called when the device display orientation changed, for example, user rotated their phone 180 degrees. | Called when the device display orientation changed, for example, user rotated their phone 180 degrees. | ||
+ | {{notice|Prior to [[11.4]], the orientation value was boolean instead of one of valid [[DisplayOrientation]] values! See below for workaround.}} | ||
== Function == | == Function == | ||
Line 12: | Line 13: | ||
=== Returns === | === Returns === | ||
Nothing. | Nothing. | ||
+ | |||
+ | == Workaround == | ||
+ | Due to a bug in LOVE 11.3, the orientation value is boolean <code>true</code> instead. A workaround is as follows: | ||
+ | <source lang="lua"> | ||
+ | function love.displayrotated(index, orientation) | ||
+ | orientation = love.window.getDisplayOrientation(index) | ||
+ | -- The rest of your code goes here. | ||
+ | end | ||
+ | </source> | ||
== See Also == | == See Also == | ||
Line 19: | Line 29: | ||
[[Category:Callbacks]] | [[Category:Callbacks]] | ||
{{#set:Description=Called when the device display orientation changed.}} | {{#set:Description=Called when the device display orientation changed.}} | ||
− | {{#set:Subcategory= | + | {{#set:Subcategory=Window}} |
== Other Languages == | == Other Languages == | ||
{{i18n|love.displayrotated}} | {{i18n|love.displayrotated}} |
Latest revision as of 04:47, 18 December 2022
Available since LÖVE 11.3 |
This callback is not supported in earlier versions. |
Called when the device display orientation changed, for example, user rotated their phone 180 degrees.
Prior to 11.4, the orientation value was boolean instead of one of valid DisplayOrientation values! See below for workaround. |
Contents
Function
Synopsis
love.displayrotated( index, orientation )
Arguments
number index
- The index of the display that changed orientation.
DisplayOrientation orientation
- The new orientation.
Returns
Nothing.
Workaround
Due to a bug in LOVE 11.3, the orientation value is boolean true
instead. A workaround is as follows:
function love.displayrotated(index, orientation)
orientation = love.window.getDisplayOrientation(index)
-- The rest of your code goes here.
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