Difference between revisions of "love.graphics.getModes"
m (Add see alsos) |
(Add slime's sorting example) |
||
Line 21: | Line 21: | ||
-- ... | -- ... | ||
-- } | -- } | ||
+ | </source> | ||
+ | === Sort table to ensure it is in order === | ||
+ | <source lang="lua"> | ||
+ | modes = love.graphics.getModes() | ||
+ | table.sort(modes, function(a, b) return a.width*a.height < b.width*b.height end) -- sort from smallest to largest | ||
</source> | </source> | ||
== See Also == | == See Also == |
Revision as of 17:59, 28 September 2011
Gets a list of supported fullscreen modes.
Contents
Function
Synopsis
modes = love.graphics.getModes( )
Arguments
None.
Returns
table modes
- A table of width/height pairs. (Note that this may not be in order.)
Examples
Format of the returned table
modes = love.graphics.getModes()
-- modes = {
-- { width = 320, height = 240 },
-- { width = 640, height = 480 },
-- { width = 800, height = 600 },
-- { width = 1024, height = 768 },
-- ...
-- }
Sort table to ensure it is in order
modes = love.graphics.getModes()
table.sort(modes, function(a, b) return a.width*a.height < b.width*b.height end) -- sort from smallest to largest
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