- Documentation
- Client functions
- dxDrawLine
Function
dxDrawLine
Draws a line between two screen points.
Syntax
bool dxDrawLine(float startX, float startY, float endX, float endY [, int color = tocolor(255, 255, 255), float width = 1, bool postGUI = false])Arguments
startXfloat- Start X.
startYfloat- Start Y.
endXfloat- End X.
endYfloat- End Y.
colorint, optional = tocolor(255, 255, 255)- Colour.
widthfloat, optional = 1- Thickness.
postGUIbool, optional = false- Above GUI.
Returns
true if drawn.
Example
A crosshair in the middle of the screen.
local sw, sh = guiGetScreenSize()
addEventHandler("onClientRender", root, function()
dxDrawLine(sw / 2 - 10, sh / 2, sw / 2 + 10, sh / 2, tocolor(255, 255, 255), 2)
dxDrawLine(sw / 2, sh / 2 - 10, sw / 2, sh / 2 + 10, tocolor(255, 255, 255), 2)
end)
See also
dxDrawLine3DDraws a line between two world points: projects them onto the screen and joins them. It only draws when both ends are on screen and is not hidden by buildings.dxDrawPrimitiveDraws a 2D shape from a list of{x, y [, color]}vertices: points, lines or triangles. The colour is blended smoothly between vertices.