HU/dxSetAspectRatioAdjustmentEnabled

From Multi Theft Auto: Wiki
Revision as of 10:35, 30 November 2018 by Surge (talk | contribs) (Created page with "__NOTOC__ {{Client function hu}} {{New feature/item|3.0140|1.3.3|5547| This function allows for the positioning of dxDraw calls to be automatically adjusted according to the...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function allows for the positioning of dxDraw calls to be automatically adjusted according to the client's aspect ratio setting. This lasts for a single execution of an event handler for one of the following events: onClientRender, onClientPreRender and onClientHUDRender. So the function has to be called every frame, just like dxDraws.

This is particularly useful for draws that must align with the GTA HUD, for which the sizing and positioning can vary for different aspect ratios.

Szintaxis

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

Kötelező paraméterek

  • bEnabled: Should the adjustment be enabled or disabled.

Tetszőleges paraméterek

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 dxDraws were originally designed in.

Visszatérési érték

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

Requirements

This template will be deleted.

PÉlda

scx,scy = guiGetScreenSize()

addEventHandler( "onClientRender", root,
    function()
        dxDrawText( "Hello", 300, 300 )             -- Text will be drawn at 300,300
        dxSetAspectRatioAdjustmentEnabled( true )
        dxDrawText( "Goodbye", 0.78*scx, 0.22*scy )  -- Text will be drawn just below HUD money, with any aspect ratio
    end
)

See Also