DxSetAspectRatioAdjustmentEnabled: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
{{New feature/item|3.0140|1.3.3|5547| | {{New feature/item|3.0140|1.3.3|5547| | ||
This function should be used when 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. | |||
}} | }} | ||
Line 17: | Line 17: | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
{{OptionalArg}} | {{OptionalArg}} | ||
* '''fSourceRatio :''' | * '''fSourceRatio :''' This should be set to the aspect ratio the dxDraw were originally designed with. | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' when | Returns ''true'' when it was changed successfully, or ''false'' otherwise. | ||
==Requirements== | ==Requirements== | ||
Line 27: | Line 27: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | 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 | |||
) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Drawing_functions}} | {{Drawing_functions}} |
Revision as of 19:55, 26 June 2013
Script Example Missing Function DxSetAspectRatioAdjustmentEnabled needs a script example, help out by writing one. | |
Before submitting check out Editing Guidelines Script Examples. |
This function should be used when 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 fSourceRatio = 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.
- fSourceRatio : This should be set to the aspect ratio the dxDraw were originally designed with.
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
- dxConvertPixels
- dxCreateFont
- dxCreateRenderTarget
- dxCreateScreenSource
- dxCreateShader
- dxCreateTexture
- dxDrawCircle
- dxDrawImage
- dxDrawImageSection
- dxDrawLine
- dxDrawLine3D
- dxDrawMaterialLine3D
- dxDrawMaterialPrimitive
- dxDrawMaterialPrimitive3D
- dxDrawMaterialSectionLine3D
- dxDrawPrimitive
- dxDrawPrimitive3D
- dxDrawRectangle
- dxDrawText
- dxDrawWiredSphere
- dxGetBlendMode
- dxGetFontHeight
- dxGetMaterialSize
- dxGetPixelColor
- dxGetPixelsSize
- dxGetPixelsFormat
- dxGetStatus
- dxGetTextSize
- dxGetTextWidth
- dxGetTexturePixels
- dxIsAspectRatioAdjustmentEnabled
- dxSetAspectRatioAdjustmentEnabled
- dxSetBlendMode
- dxSetPixelColor
- dxSetRenderTarget
- dxSetShaderValue
- dxSetShaderTessellation
- dxSetShaderTransform
- dxSetTestMode
- dxSetTextureEdge
- dxSetTexturePixels
- dxUpdateScreenSource