Renderer
Renderer namespace with useful drawing functions.
Please do not overuse these in your final production scripts as these calls made from Lua may cause heavy impact on performance.
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
Argument | Type | Description |
---|---|---|
r | number | Red 0-255 |
g | number | Green 0-255 |
b | number | Blue 0-255 |
a | number | Alpha 0-255 |
Get proper color value
DrawCircle3D
Renderer.DrawCircle3D(
position: Vector2,
radius: number,
sides: number,
width: number,
color: number
)
→ void
Argument | Type | Description |
---|---|---|
position | Vector2 | Center position. |
radius | number - integer | Radius |
sides | number - integer | Sides |
width | number - integer | Line width |
color | number - D3DCOLOR | Color |
Draw basic circle in game world.
DrawCircle3D
Renderer.DrawCircle3D(
position: Vector3,
radius: number,
sides: number,
width: number,
color: number
)
→ void
Argument | Type | Description |
---|---|---|
position | Vector3 | Center position. |
radius | number - integer | Radius |
sides | number - integer | Sides |
width | number - integer | Line width |
color | number - D3DCOLOR | Color |
Draw basic circle in game world.
DrawVectorPoly
Renderer.DrawVectorPoly(vectorPoly: Vector2[], width: number, color: number)
→ void
Argument | Type | Description |
---|---|---|
vectorPoly | Vector2[] | Points which make a path. |
width | number - float | Line width. |
color | number - D3DCOLOR | Line color. |
Draw vector poly path.
DrawVectorPoly
Renderer.DrawVectorPoly(vectorPoly: Vector3[], width: number, color: number)
→ void
Argument | Type | Description |
---|---|---|
vectorPoly | Vector3[] - std::vector<Vector3> | Points which make a path. |
width | number - float | Line width. |
color | number - D3DCOLOR | Line color. |
Draw vector poly path.
DrawCross
Renderer.DrawCross(position: Vector2, size?: number, color?: number)
→ void
Argument | Type | Description |
---|---|---|
position | Vector2 | World position. |
size? | number - float | Cross size. 100 by default. |
color? | number - D3DCOLOR | Line color. White by default. |
Draw cross in game world.
Useful to see exact position of any unit in game.
DrawText
Renderer.DrawText(
text: string,
position: Vector2,
size?: number,
color?: number
)
→ void
Argument | Type | Description |
---|---|---|
text | string | Text you want to display. |
position | Vector2 | On-screen position for your text. Starts from top-left corner. |
size? | number - float | Font size. 12 by default. |
color? | number - D3DCOLOR | Font color. White by default. |
Draw basic ImGui
text.
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
Argument | Type | Description |
---|---|---|
text | string | Text you want to display. |
position | Vector3 | World position. |
offset? | Vector2 | On-screen offset. Vector2(0,0) by default. |
size? | number - float | Font size. 12 by default. |
color? | number - D3DCOLOR | Font color. White by default. |
Draw basic ImGui
text in game world.
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
Argument | Type | Description |
---|---|---|
hash | number - integer | Unique fnv hash. |
position | Vector2 | Position. |
radius | number | Radius. |
colorInfo? | ColorInfo | ColorInfo struct. White solid by default. |
effectType? | EffectType | Shader effect type. GlowingCircle by default. |
Draw fancy shader circle.
It is important to use unique fnv hash for this. Please use unique prefix when generating this hash.
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
Argument | Type | Description |
---|---|---|
text | string | Text string. |
fontSize | number - float | Text font size. |
Returns calculated text width and height.
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)