DxCreateTexture: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 18: | Line 18: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
root = getRootElement() | |||
addEventHandler( "onClientRender", root, | addEventHandler( "onClientRender", root, | ||
function() | function() |
Revision as of 11:08, 28 August 2011
Only available in 1.1 This function creates a texture element that can be used in the dxDraw functions
Syntax
element dxCreateTexture ( string filepath )
Required Arguments
- filepath: The filepath of the image. (.dds images are also supported). Image files should ideally have dimensions that are a power of two, to prevent possible blurring.
Returns
Returns a texture if successful, false if invalid arguments were passed to the function.
Example
root = getRootElement() addEventHandler( "onClientRender", root, function() if myImage then dxDrawImage( 100, 350, 300, 350, myImage ) end end ) -- Use 'toggle' command to switch image on and off addCommandHandler( "toggle", function() if not myImage then myImage = dxCreateTexture( "moonpig.png" ) -- Create texture else destroyElement( myImage ) -- Destroy texture myImage = nil end 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