Renderer
Renderer namespace with useful drawing functions ready for production.
For optimal performance and better visual quality, please prefer using functions described on this page in your final production.
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
GetResolution
Renderer.GetResolution() → Vector2
Get current game resolution
DrawCircleGlow
Renderer.DrawCircleGlow(
hash: number - integer,
position: Vector3,
radius: number,
colorData: ColorData,
options?: DrawCircleGlowOptions
) → void
| Argument | Type | Description |
|---|---|---|
| hash | number - integer | Unique fnv hash. |
| position | Vector3 | Position. |
| radius | number | Radius. |
| colorData | ColorData | ColorData struct. |
| options? | DrawCircleGlowOptions | Drawing options. For default values see its page. |
Draw fancy glow circle using shaders.
Callback.Bind(CallbackType.OnDraw, function()
for i = 1, 10, 1 do
local tbl = {
renderStage = Renderer.RenderStage.HUD, -- HUD instead of World, because we want to draw on top of grass, champions and structures.
isUsingDepth = false, -- This part of sphere is barely visible and blurred, we disable depth here to create effect of visibility when sphere rings go behind walls.
isUsingHeightMap = false, -- No need to project on the ground.
isCulling = false, -- False, because we need to render from both sides due to 3D rotation animation.
rotation = Math.Vector3((Game.GetTime() + i * 0.5 * 1) % (math.pi*2), (Game.GetTime() + i * 0.5 * 1) % (math.pi*2), (Game.GetTime() + i * 0.5 * 1) % (math.pi*2)), -- Animated 3D rotation
blurIn = 30,
blurOut = 30,
}
Renderer.DrawCircleGlow(Game.fnvhash("ExampleB_CircleGlowA" .. i), Game.localPlayer.position, 200 + math.sin(Game.GetTime()) * (50 + i*10) + (50 + i*10), Renderer.ColorData(Renderer.GradientType.Linear, 0x110000FF, 0x11FF0000, ((Game.GetTime()*2 + i) % (math.pi*2)) * 2), tbl)
end
for i = 1, 10, 1 do
local tbl = {
renderStage = Renderer.RenderStage.HUD,
isUsingDepth = true, -- This is the main part of sphere, it's crisp, but we want it to be hidden inside walls.
isUsingHeightMap = false,
isCulling = false,
rotation = Math.Vector3((Game.GetTime() + i * 0.5 * 1) % (math.pi*2), (Game.GetTime() + i * 0.5 * 1) % (math.pi*2), (Game.GetTime() + i * 0.5 * 1) % (math.pi*2)),
}
Renderer.DrawCircleGlow(Game.fnvhash("ExampleB_CircleGlowB" .. i), Game.localPlayer.position, 200 + math.sin(Game.GetTime()) * (50 + i*10) + (50 + i*10), Renderer.ColorData(Renderer.GradientType.Linear, 0x77FFFFFF, 0x77FF0000, ((Game.GetTime()*2 + i) % (math.pi*2)) * 2), tbl)
end
end)
DrawCircleMagical
Renderer.DrawCircleMagical(
hash: number - integer,
position: Vector3,
radius: number,
colorData: ColorData,
options?: BaseMeshDrawOptions
) → void
| Argument | Type | Description |
|---|---|---|
| hash | number - integer | Unique fnv hash. |
| position | Vector3 | Position. |
| radius | number | Radius. |
| colorData | ColorData | ColorData struct. |
| options? | BaseMeshDrawOptions | Drawing options. For default values see its page. |
Draw fancy magic circle using shaders.
DrawCirclePulse
Renderer.DrawCirclePulse(
hash: number - integer,
position: Vector3,
radius: number,
colorData: ColorData,
options?: DrawCirclePulseOptions
) → void
| Argument | Type | Description |
|---|---|---|
| hash | number - integer | Unique fnv hash. |
| position | Vector3 | Position. |
| radius | number | Radius. |
| colorData | ColorData | ColorData struct. |
| options? | DrawCirclePulseOptions | Drawing options. For default values see its page. |
Draw fancy pulse circle using shaders.
DrawCirclePulse2
Renderer.DrawCirclePulse2(
hash: number - integer,
position: Vector3,
radius: number,
colorData: ColorData,
options?: DrawCirclePulse2Options
) → void
| Argument | Type | Description |
|---|---|---|
| hash | number - integer | Unique fnv hash. |
| position | Vector3 | Position. |
| radius | number | Radius. |
| colorData | ColorData | ColorData struct. |
| options? | DrawCirclePulse2Options | Drawing options. For default values see its page. |
Draw alternative fancy pulse circle using shaders.
DrawCircleShine
Renderer.DrawCircleShine(
hash: number - integer,
position: Vector3,
radius: number,
colorData: ColorData,
options?: DrawCircleShineOptions
) → void
| Argument | Type | Description |
|---|---|---|
| hash | number - integer | Unique fnv hash. |
| position | Vector3 | Position. |
| radius | number | Radius. |
| colorData | ColorData | ColorData struct. |
| options? | DrawCircleShineOptions | Drawing options. For default values see its page. |
Draw fancy pulse circle using shaders.
DrawCircleTarget
Renderer.DrawCircleTarget(
hash: number - integer,
position: Vector3,
radius: number,
colorData: ColorData,
options?: BaseMeshDrawOptions
) → void
| Argument | Type | Description |
|---|---|---|
| hash | number - integer | Unique fnv hash. |
| position | Vector3 | Position. |
| radius | number | Radius. |
| colorData | ColorData | ColorData struct. |
| options? | BaseMeshDrawOptions | Drawing options. For default values see its page. |
Draw fancy pulse circle using shaders.
DrawEffectCircle (Deprecated)
Renderer.DrawEffectCircle(
hash: number - integer,
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 fnvhash for this. Please use unique prefix when generating this hash.
This function is deprecated and it's kept for backwards compatibility. Use other fancy drawing functions, such as DrawCircleX, DrawTextEx, DrawTexture, etc.
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)
DrawTextEx
Renderer.DrawTextEx(
hash: number - integer,
text: string,
position: Vector2,
colorData: ColorData,
options?: DrawTextOptions
) → void
| Argument | Type | Description |
|---|---|---|
| hash | number - integer | Unique fnv hash. |
| text | string | Text to be displayed. |
| position | Vector2 | Position. |
| colorData | ColorData | ColorData struct. |
| options? | DrawTextOptions | Drawing options. For default values see its page. |
Draw text using our Renderer in 2D space (UI, HUD).
DrawTextEx
Renderer.DrawTextEx(
hash: number - integer,
text: string,
position: Vector3,
colorData: ColorData,
options?: DrawTextOptions
) → void
| Argument | Type | Description |
|---|---|---|
| hash | number - integer | Unique fnv hash. |
| text | string | Text to be displayed. |
| position | Vector3 | Position. |
| colorData | ColorData | ColorData struct. |
| options? | DrawTextOptions | Drawing options. For default values see its page. |
Draw text using our Renderer in 3D space (Game World).
DrawTexture
Renderer.DrawTexture(
hash: number - integer,
textureHandle: number,
position: Vector2,
size: Vector2,
colorData: ColorData,
options?: DrawTextureOptions
) → void
| Argument | Type | Description |
|---|---|---|
| hash | number - integer | Unique fnv hash. |
| textureHandle | number | Texture handle. |
| position | Vector2 | Position. |
| size | Vector2 | Size. |
| colorData | ColorData | ColorData struct. |
| options? | DrawTextureOptions | Drawing options. For default values see its page. |
Draw a texture (sprite) in 2D space (UI, HUD).
local texHandle = Renderer.AddTexture("example.png") -- Make sure you have example.png in your script folder
Callback.Bind(CallbackType.OnDraw, function()
Renderer.DrawTexture(Game.fnvhash("DrawTexture2D_1"), texHandle, Math.Vector2(300, 300), Math.Vector2(200, 200),Renderer.ColorData(Renderer.GradientType.Linear, 0xFF00FFFF, 0xFFFF0000, (Game.GetTime()*2 % (math.pi*2)) * 2), {
sortOrder = 0
})
Renderer.DrawTexture(Game.fnvhash("DrawTexture2D_2"), texHandle, Math.Vector2(310, 310), Math.Vector2(200, 200), Renderer.ColorData(Renderer.GradientType.Linear, 0xFF0000FF, 0xFFFF0000, (Game.GetTime()*2 % (math.pi*2)) * 2), {
sortOrder = 1
})
Renderer.DrawTexture(Game.fnvhash("DrawTexture2D_3"), texHandle, Math.Vector2(320, 320), Math.Vector2(200, 200), Renderer.ColorData(Renderer.GradientType.Linear, 0xFFFF00FF, 0xFFFF0000, (Game.GetTime()*2 % (math.pi*2)) * 2), {
sortOrder = 2
})
end)
DrawTexture
Renderer.DrawTexture(
hash: number - integer,
textureHandle: number,
position: Vector3,
size: Vector2,
colorData: ColorData,
options?: DrawTextureOptions
) → void
| Argument | Type | Description |
|---|---|---|
| hash | number - integer | Unique fnv hash. |
| textureHandle | number | Texture handle. |
| position | Vector3 | Position. |
| size | Vector2 | Size. |
| colorData | ColorData | ColorData struct. |
| options? | DrawTextureOptions | Drawing options. For default values see its page. |
Draw a texture (sprite) in 3D space (Game World).
local texHandle = Renderer.AddTexture("example.png") -- Make sure you have example.png in your script folder
Callback.Bind(CallbackType.OnDraw, function()
Renderer.DrawTexture(
Game.fnvhash("DrawTexture3D"),
texHandle,
Math.Vector3(Game.localPlayer.position.X, Game.localPlayer.position.Y + 100, Game.localPlayer.position.Z),
Math.Vector2(400, 400),
Renderer.ColorData(Renderer.GradientType.Linear, 0xFF0000FF, 0xFFFF0000, (Game.GetTime()*2 % (math.pi*2)) * 2)
)
end)
AddTexture
Renderer.AddTexture( filePath: string - path ) → number - handle
| Argument | Type | Description |
|---|---|---|
| filePath | string - path | Relative path from your module.lua to the texture. Make sure to use double slash \\ instead of /. |
Adds texture to DrawManager and returns unique texture handle.
Make sure to use double slash \\ instead of /.
Although / will work during your development, it will not work in production script when you upload it to our server.