GetTextureDisplayAspectRatio
Description
Get the ratio that should be used to draw a texture without affecting its aspect ratio. This value is the same as dividing the texture's aspect ratio by the display's aspect ratio.
For the reasons described in GetDisplayResolution, you should call this function each frame it is needed rather than just once at setup.
function GetTextureDisplayAspectRatio(texture) --[[ ... ]] end
Parameters
texture:userdata- The texture to get the display aspect ratio for.
Return Values
aspectRatio:number- The aspect ratio of the texture relative to the display resolution.
Example
local texture = CreateTexture('path/to/texture.png')
local aspectRatio = GetTextureDisplayAspectRatio(texture)
print('Display Aspect Ratio: ' .. aspectRatio) -- Outputs the display aspect ratio of the texture