Skip to main content

Renderer

Renderer namespace with useful drawing functions.

caution

Please do not overuse these in your final production scripts as these calls made from Lua may cause heavy impact on performance.

tip

For optimal performance prefer using Renderer.DrawEffectCircle function in your final production scripts.

Functions

RGBA

Renderer.RGBA(r: number, g: number, b: number, a: number) number

ArgumentTypeDescription
rnumberRed 0-255
gnumberGreen 0-255
bnumberBlue 0-255
anumberAlpha 0-255

Get proper color value


DrawCircle3D

Renderer.DrawCircle3D(
position: Vector2,
radius: number,
sides: number,
width: number,
color: number
) void

ArgumentTypeDescription
positionVector2Center position.
radiusnumber - integerRadius
sidesnumber - integerSides
widthnumber - integerLine width
colornumber - D3DCOLORColor

Draw basic circle in game world.


DrawCircle3D

Renderer.DrawCircle3D(
position: Vector3,
radius: number,
sides: number,
width: number,
color: number
) void

ArgumentTypeDescription
positionVector3Center position.
radiusnumber - integerRadius
sidesnumber - integerSides
widthnumber - integerLine width
colornumber - D3DCOLORColor

Draw basic circle in game world.


DrawVectorPoly

Renderer.DrawVectorPoly(vectorPoly: Vector2[], width: number, color: number) void

ArgumentTypeDescription
vectorPolyVector2[]Points which make a path.
widthnumber - floatLine width.
colornumber - D3DCOLORLine color.

Draw vector poly path.


DrawVectorPoly

Renderer.DrawVectorPoly(vectorPoly: Vector3[], width: number, color: number) void

ArgumentTypeDescription
vectorPolyVector3[] - std::vector<Vector3>Points which make a path.
widthnumber - floatLine width.
colornumber - D3DCOLORLine color.

Draw vector poly path.


DrawCross

Renderer.DrawCross(position: Vector2, size?: number, color?: number) void

ArgumentTypeDescription
positionVector2World position.
size?number - floatCross size. 100 by default.
color?number - D3DCOLORLine color. White by default.

Draw cross in game world.

tip

Useful to see exact position of any unit in game.


DrawText

Renderer.DrawText(
text: string,
position: Vector2,
size?: number,
color?: number
) void

ArgumentTypeDescription
textstringText you want to display.
positionVector2On-screen position for your text. Starts from top-left corner.
size?number - floatFont size. 12 by default.
color?number - D3DCOLORFont color. White by default.

Draw basic ImGui text.

note

Unlike most other Renderer functions, all ImGui functions must be used in OnImguiDraw callback.


DrawWorldText

Renderer.DrawWorldText(
text: string,
position: Vector3,
offset?: Vector2,
size?: number,
color?: number
) void

ArgumentTypeDescription
textstringText you want to display.
positionVector3World position.
offset?Vector2On-screen offset. Vector2(0,0) by default.
size?number - floatFont size. 12 by default.
color?number - D3DCOLORFont color. White by default.

Draw basic ImGui text in game world.

note

Unlike most other Renderer functions, all ImGui functions must be used in OnImguiDraw callback.


DrawEffectCircle

Renderer.DrawEffectCircle(
hash: number,
position: Vector2,
radius: number,
colorInfo?: ColorInfo,
effectType?: EffectType
) void

ArgumentTypeDescription
hashnumber - integerUnique fnv hash.
positionVector2Position.
radiusnumberRadius.
colorInfo?ColorInfoColorInfo struct. White solid by default.
effectType?EffectTypeShader effect type. GlowingCircle by default.

Draw fancy shader circle.

caution

It is important to use unique fnv hash for this. Please use unique prefix when generating this hash.

Example: Draw fancy shader circle around selected target.
local MyGlowingCircleHash = Game.fnvhash("Example_MyGlowingCircle") -- This must be unique hash per drawing. Use unique prefix.
local color = Renderer.ColorInfo.new(0xFFFFFFFF, 0xFF5555FF, Renderer.GradientType.Linear)
local radius = 100
Callback.Bind(CallbackType.OnDraw, function()
local tar = Game.GetSelectedTarget()
if tar and tar:IsValid() then
Renderer.DrawEffectCircle(MyGlowingCircleHash, tar.position2D, radius, color, Renderer.EffectType.MagicalCircle)
end
end)

CalcTextSize

Renderer.CalcTextSize(text: string, fontSize: number) number, number

ArgumentTypeDescription
textstringText string.
fontSizenumber - floatText font size.

Returns calculated text width and height.

Example: Draw a centered text indicator under player, showing whether he is inside enemy turret range or not.
local fontSize = 16
Callback.Bind(CallbackType.OnImguiDraw, function()
local text = TurretTracker.IsPlayerInsideTurret() and "Inside" or "Outside"
local tX, tY = Renderer.CalcTextSize(text, fontSize)
Renderer.DrawWorldText(text, Game.localPlayer.position, Math.Vector2(-tX/2, 0), fontSize)
end)