Difference between revisions of "love.graphics.getCanvasFormats"
(Created page) |
m |
||
Line 39: | Line 39: | ||
* [[Canvas]] | * [[Canvas]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | {{#set:Sub-Category= | + | {{#set:Sub-Category=SystemInfo}} |
{{#set:Description=Gets the available [[CanvasFormat|Canvas formats]], and whether each is supported.}} | {{#set:Description=Gets the available [[CanvasFormat|Canvas formats]], and whether each is supported.}} | ||
== Other Languages == | == Other Languages == | ||
{{i18n|love.graphics.getCanvasFormats}} | {{i18n|love.graphics.getCanvasFormats}} |
Revision as of 01:59, 17 July 2017
Available since LÖVE 0.9.2 |
This function is not supported in earlier versions. |
Gets the available Canvas formats, and whether each is supported.
Contents
Function
Synopsis
formats = love.graphics.getCanvasFormats( )
Arguments
None.
Returns
table formats
- A table containing CanvasFormats as keys, and a boolean indicating whether the format is supported as values. Not all systems support all formats.
Examples
Create a canvas with the format 'rgba16f' if it is supported
local formats = love.graphics.getCanvasFormats()
if formats.rgba16f then
canvas = love.graphics.newCanvas(800, 600, "rgba16f")
else
-- The 'rgba16f' format isn't supported. We could have some fallback code, or trigger a message telling the user their system is unsupported.
end
Display a list of the canvas formats on the screen
canvasformats = love.graphics.getCanvasFormats()
function love.draw()
local y = 0
for formatname, formatsupported in pairs(canvasformats) do
local str = string.format("Supports format '%s': %s", formatname, tostring(formatsupported))
love.graphics.print(str, 10, y)
y = y + 20
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