DxIsAspectRatioAdjustmentEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Remove requirements as git doesnt show when this function was added)
(Remove obsolete Requirements section)
Tag: Manual revert
 
(5 intermediate revisions by one other user not shown)
Line 3: Line 3:


{{New feature/item|3.0140|1.3.3|5547|
{{New feature/item|3.0140|1.3.3|5547|
This function gets the current aspect ratio set by [[dxIsAspectRatioAdjustmentEnabled]].
This function gets the current aspect ratio set by [[dxSetAspectRatioAdjustmentEnabled]].
}}
}}


Line 16: Line 16:


==Example==
==Example==
This example will draw the aspect ratio to screen if aspect ratio was enabled previously.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- TODO --
addEventHandler("onClientRender", root, function()
    dxSetAspectRatioAdjustmentEnabled(true)
 
    local enabled, ratio = dxIsAspectRatioAdjustmentEnabled()
    if(enabled) then
        dxDrawText("Aspect ratio is: " .. ratio, 250, 250)
    end
end)
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Drawing_functions}}
{{Drawing_functions}}

Latest revision as of 17:17, 7 November 2024

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