DxIsAspectRatioAdjustmentEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Add example)
(Fix example and typo)
Line 16: Line 16:


==Example==
==Example==
This example will draw the aspect ratio to screen if aspect ratio was set.
This example will draw the aspect ratio to screen if aspect ratio was enabled previously.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler("onClientRender", root, function()
addEventHandler("onClientRender", root, function()
    dxSetAspectRatioAdjustmentEnabled(true)
     local enabled, ratio = dxIsAspectRatioAdjustmentEnabled()
     local enabled, ratio = dxIsAspectRatioAdjustmentEnabled()

Revision as of 01:29, 13 December 2019

This function gets the current aspect ratio set by DxSetAspectRatioAdjustmentEnabled.

Syntax

bool, float dxIsAspectRatioAdjustmentEnabled ( )

Returns

Example

This example will draw the aspect ratio to screen if aspect ratio was enabled previously.

addEventHandler("onClientRender", root, function()
    dxSetAspectRatioAdjustmentEnabled(true)

    local enabled, ratio = dxIsAspectRatioAdjustmentEnabled()
	
    if(enabled) then
        dxDrawText("Aspect ratio is: " .. ratio, 250, 250)
    end
end)

See Also