ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. dxDrawImageSection

Function

dxDrawImageSection

ClientDrawing (dx)Identical to MTA:SA

Draws a section of an image (u, v, section width and height in image pixels) in a screen rectangle. Useful for icon sheets and progress bars.

Syntax

bool dxDrawImageSection(float posX, float posY, float width, float height, float u, float v, float usize, float vsize, string|element image [, float rotation = 0, float rotationCenterOffsetX = 0, float rotationCenterOffsetY = 0, int color = tocolor(255, 255, 255), bool postGUI = false])

Arguments

posXfloat
Left edge.
posYfloat
Top edge.
widthfloat
Width.
heightfloat
Height.
ufloat
Section X in the image.
vfloat
Section Y in the image.
usizefloat
Section width.
vsizefloat
Section height.
imagestring|element
A path or a material.
rotationfloat, optional = 0
Rotation.
rotationCenterOffsetXfloat, optional = 0
Rotation centre X.
rotationCenterOffsetYfloat, optional = 0
Rotation centre Y.
colorint, optional = tocolor(255, 255, 255)
Tint.
postGUIbool, optional = false
Above GUI.

Returns

true if drawn.

Example

A sheet of four 64 px icons; we draw the third.

addEventHandler("onClientRender", root, function()
    dxDrawImageSection(20, 200, 64, 64, 128, 0, 64, 64, "img/ikony.png")
end)

See also