dxDrawLine
Client-side
Server-side
Shared
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function draws a 2D line across the screen - rendered for one frame. This should be used in conjunction with onClientRender in order to display continuously.
Syntax
bool dxDrawLine ( int startX, int startY, int endX, int endY, int color, [ float width = 1.0, bool postGUI = false ] )Required Arguments
- startX: An integer representing the absolute start X position of the line, represented by pixels on the screen.
- startY: An integer representing the absolute start Y position of the line, represented by pixels on the screen.
- endX: An integer representing the absolute end X position of the line, represented by pixels on the screen.
- endY: An integer representing the absolute end Y position of the line, represented by pixels on the screen.
- color: An integer of the hex color, produced using tocolor or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.
- width (default: 1.0): MISSING_PARAM_DESC
- postGUI (default: false): MISSING_PARAM_DESC
Returns
- bool: value
Returns a true if the operation was successful, false otherwise.
Code Examples
shared
This example draws an 'X' across the screen.
local screenWidth, screenHeight = guiGetScreenSize()local lineColor = tocolor(255, 0, 0)function drawLinesAcrossScreen() dxDrawLine(0, 0, screenWidth, screenHeight, lineColor) dxDrawLine(screenWidth, 0, 0, screenHeight, lineColor)endaddEventHandler("onClientRender", root, drawLinesAcrossScreen)See Also
Drawing Functions
- dxConvertPixels
- dxCreateFont
- dxCreateRenderTarget
- dxCreateScreenSource
- dxCreateShader
- dxCreateTexture
- dxDrawCircle
- dxDrawImage
- dxDrawImageSection
- dxDrawLine
- dxDrawLine3D
- dxDrawMaterialLine3D
- dxDrawMaterialPrimitive
- dxDrawMaterialPrimitive3D
- dxDrawMaterialSectionLine3D
- dxDrawModel3D
- dxDrawPrimitive
- dxDrawPrimitive3D
- dxDrawRectangle
- dxDrawText
- dxDrawWiredSphere
- dxGetBlendMode
- dxGetFontHeight
- dxGetMaterialSize
- dxGetPixelColor
- dxGetPixelsFormat
- dxGetPixelsSize
- dxGetStatus
- dxGetTextSize
- dxGetTexturePixels
- dxGetTextWidth
- dxIsAspectRatioAdjustmentEnabled
- dxSetAspectRatioAdjustmentEnabled
- dxSetBlendMode
- dxSetPixelColor
- dxSetRenderTarget
- dxSetShaderTessellation
- dxSetShaderTransform
- dxSetShaderValue
- dxSetTestMode
- dxSetTextureEdge
- dxSetTexturePixels
- dxUpdateScreenSource