DxSetAspectRatioAdjustmentEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool dxSetAspectRatioAdjustmentEnabled ( bool bEnabled [, float fSourceRatio = 4/3 ] )
bool dxSetAspectRatioAdjustmentEnabled ( bool bEnabled [, float sourceRatio = 4/3 ] )
</syntaxhighlight>
</syntaxhighlight>


Line 16: Line 16:
===Optional Arguments===
===Optional Arguments===
{{OptionalArg}}
{{OptionalArg}}
* '''fSourceRatio :''' This should be set to the aspect ratio the dxDraw were originally designed in.
* '''sourceRatio :''' This should be set to the aspect ratio the dxDraw were originally designed in.


===Returns===
===Returns===

Revision as of 19:57, 26 June 2013

This function is used to aligning the output of dxDraw calls with GTA HUD components. It can only be called during these events: onClientRender, onClientPreRender and onClientHUDRender, and is automatically disabled when these events return. So the function has to be called every frame, just like dxDraws.

Syntax

bool dxSetAspectRatioAdjustmentEnabled ( bool bEnabled [, float sourceRatio = 4/3 ] )

Required Arguments

  • bEnabled: Should the adjustment be enabled or disabled.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • sourceRatio : This should be set to the aspect ratio the dxDraw were originally designed in.

Returns

Returns true when it was changed successfully, or false otherwise.

Requirements

This template will be deleted.

Example

addEventHandler("onClientRender",root,
    function()
        dxDrawText("Hello", 100, 100 )             -- Text will be drawn at 100,100
        dxSetAspectRatioAdjustmentEnabled( true )
        dxDrawText("Goodbye", 100, 100 )           -- Text will be drawn at some adjusted position
    end
)

See Also