dxDrawText
Client-side
Server-side
Shared
This page is incomplete! Help wanted!
Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.
Draws a string of text on the screen for one frame. In order for the text to stay visible continuously, you need to call this function with the same parameters on each frame update (see onClientRender).
Note
The function is known to optimize certain drawing scenarios related to scaling and opacity (so called text on raster optimisation ). You can find out more about it here .
Syntax
dxDrawText ( )Code Examples
client
This example code will add the current zone name in the lower left corner of the players' screens.
local screenX, screenY = guiGetScreenSize() -- get the screen resolution (width and height)local shadowColor = tocolor(0, 0, 0, 255) -- define shadow color outside render scope and use it afterwards (for performance reasons)local textColor = tocolor(255, 255, 255, 255) -- define color outside render scope and use it afterwards (for performance reasons)
function renderPlayerZone() local playerX, playerY, playerZ = getElementPosition(localPlayer) -- get our player's coordinates local playerZoneName = getZoneName(playerX, playerY, playerZ) -- get name of the zone the player is in
-- draw zone name text's shadow dxDrawText(playerZoneName, 44, screenY - 41, screenX, screenY, shadowColor, 1.02, "pricedown") -- draw zone name text dxDrawText(playerZoneName, 44, screenY - 43, screenX, screenY, textColor, 1, "pricedown")endaddEventHandler("onClientRender", root, renderPlayerZone)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