HU/dxSetAspectRatioAdjustmentEnabled: Difference between revisions
No edit summary |
Fernando187 (talk | contribs) (Remove obsolete Requirements section) |
||
Line 22: | Line 22: | ||
===Visszatérési érték=== | ===Visszatérési érték=== | ||
Returns ''true'' when it was changed successfully, or ''false'' otherwise. | Returns ''true'' when it was changed successfully, or ''false'' otherwise. | ||
==PÉlda== | ==PÉlda== |
Latest revision as of 17:16, 7 November 2024
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
Megjegyzés: Amikor tetszőleges paramétereket használ, előfordulhat, hogy az összes paramétert meg kell adnia, mielőtt egyet is használna. További információkért látogassa meg a tetszőleges paraméterek oldalt.
- 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.
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
- HU/dxConvertPixels
- HU/dxCreateFont
- HU/dxCreateRenderTarget
- HU/dxCreateScreenSource
- HU/dxCreateShader
- HU/dxCreateTexture
- HU/dxDrawCircle
- HU/dxDrawImage
- HU/dxDrawImageSection
- HU/dxDrawLine
- HU/dxDrawLine3D
- HU/dxDrawMaterialLine3D
- HU/dxDrawMaterialPrimitive
- HU/dxDrawPrimitive
- HU/dxDrawMaterialSectionLine3D
- HU/dxDrawRectangle
- HU/dxDrawText
- HU/dxGetBlendMode
- HU/dxGetFontHeight
- HU/dxGetMaterialSize
- HU/dxGetPixelColor
- HU/dxGetPixelsSize
- HU/dxGetPixelsFormat
- HU/dxGetStatus
- HU/dxGetTextWidth
- HU/dxGetTexturePixels
- HU/dxSetAspectRatioAdjustmentEnabled
- HU/dxSetBlendMode
- HU/dxSetPixelColor
- HU/dxSetRenderTarget
- HU/dxSetShaderValue
- HU/dxSetShaderTessellation
- HU/dxSetShaderTransform
- HU/dxSetTestMode
- HU/dxSetTextureEdge
- HU/dxSetTexturePixels
- HU/dxUpdateScreenSource