Skip to content
English

Render Client Side Only

Render is an API to help with in-world and on screen drawing. (Text, Sprites, etc.)

WorldToScreen

Converts an in-world coordinate to a screen position

ParameterDescription
pos (vector3)in-world position

Returns vector 2 screen coords.

Returns Bool if its on screen

object:WorldToScreen(vector3(x, y, z))

Example Usage:

lua
RegisterCommand('trigger', function()
    local coords, onscreen = FeatherCore.Render:WorldToScreen(GetEntityCoords(PlayerPedId()))

    print(coords.x, coords.y, onscreen)
end)
RegisterCommand('trigger', function()
    local coords, onscreen = FeatherCore.Render:WorldToScreen(GetEntityCoords(PlayerPedId()))

    print(coords.x, coords.y, onscreen)
end)

WorldToHud

Converts in-world coordinate to a hud position (bounded to screen)

ParameterDescription
pos (vector3)in-world position

Returns vector 2 screen coords

Returns Bool if its on screen

object:WorldToHud(vector3(x, y, z))

Example Usage:

lua
RegisterCommand('trigger', function()
    local coords, onscreen = FeatherCore.Render:WorldToHud(GetEntityCoords(PlayerPedId()))

    print(coords.x, coords.y, onscreen)
end)
RegisterCommand('trigger', function()
    local coords, onscreen = FeatherCore.Render:WorldToHud(GetEntityCoords(PlayerPedId()))

    print(coords.x, coords.y, onscreen)
end)

DrawSprite

Draw Sprites on screen

ParameterDescription
pos (vector2)table containing x and y coords of sprite position on screen
size (vector2)table containing x and y sizes (relative to screen x and y size, ranges from 0.0-1.0)
rotation (float)number of sprite rotation in degrees
color (vector3)table of rgba values
texturedictName of texture dictionary to load texture from (e.g. "CommonMenu", "MPWeaponsCommon", etc.)
texturenameName of texture to load from texture dictionary (e.g. "last_team_standing_icon", "tennis_icon", etc.)

featherRender:DrawSprite(pos, size, rotation, color, texturedict, texturename)

Example Usage:

lua
CreateThread(function()
    while  true  do
        Wait(0)
        local onScreen, _x, _y = GetScreenCoordFromWorldCoord(GetEntityCoords(PlayerPedId()))

        if onScreen then
            FeatherCore.Render:DrawSprite(vector2(_x, _y), vector2(0.2, 0.2), 190.0, {r: 255, g: 0, b: 0, a: 255},  "feeds", "hud_menu_4a")
        end
    end
end)
CreateThread(function()
    while  true  do
        Wait(0)
        local onScreen, _x, _y = GetScreenCoordFromWorldCoord(GetEntityCoords(PlayerPedId()))

        if onScreen then
            FeatherCore.Render:DrawSprite(vector2(_x, _y), vector2(0.2, 0.2), 190.0, {r: 255, g: 0, b: 0, a: 255},  "feeds", "hud_menu_4a")
        end
    end
end)

Draw Rectangle

Draw a rectangle on screen

ParameterDescription
pos (vector2)table containing x and y coords of sprite position on screen (ranges from 0.0-1.0)
size (vector2)table containing x and y sizes (ranges from 0.0-1.0)
color (vector3)table of rgba values

featherRender:DrawRectangle(pos, size, color)

Example Usage:

lua
CreateThread(function()
    while  true  do
        Wait(0)
        local onScreen, _x, _y = GetScreenCoordFromWorldCoord(GetEntityCoords(PlayerPedId()))

        if onScreen then
            FeatherCore.Render:DrawRectangle(vector2(_x, _y), vector2(0.2, 0.2), {r: 255, g: 0, b: 0, a: 255})
        end
    end
end)
CreateThread(function()
    while  true  do
        Wait(0)
        local onScreen, _x, _y = GetScreenCoordFromWorldCoord(GetEntityCoords(PlayerPedId()))

        if onScreen then
            FeatherCore.Render:DrawRectangle(vector2(_x, _y), vector2(0.2, 0.2), {r: 255, g: 0, b: 0, a: 255})
        end
    end
end)

Draw Marker

Draw a Marker in-world

ParameterDescription
type
postable containing x y and z coords
dirtable containing x y and z coords
rotrotation of the marker
scaletable containing x y and z scale
colortable of rgba values
bobupanddowndoes it bounce (true/false)
facecamerashould it face the camera (true/false)
rotatedoes the marker rotate (true/false)
drawonents(true/false)

featherRender:DrawMarker(type, pos, dir, rot, scale, color, bob, facevamera, rotate, drawonents)

Example Usage:

lua
CreateThread(function()
    while  true  do
        Wait(0)
        FeatherCore.Render:DrawMarker(0x50638AB9, GetEntityCoords(PlayerPedId()), vector3(0.0, 0.0, 0.0), vector3(0.0, 0.0, 0.0), vecotr3(0.15, 0.15, 0.15), {r: 255, g: 0, b: 0, a: 255}, false, false, false, false)
    end
end)
CreateThread(function()
    while  true  do
        Wait(0)
        FeatherCore.Render:DrawMarker(0x50638AB9, GetEntityCoords(PlayerPedId()), vector3(0.0, 0.0, 0.0), vector3(0.0, 0.0, 0.0), vecotr3(0.15, 0.15, 0.15), {r: 255, g: 0, b: 0, a: 255}, false, false, false, false)
    end
end)

Draw Text

Draw a Text on screen

ParameterDescription
postable containing x and y coords of text position (0-1, 0-1)
textthe text to display
colortable of rgba values
scalescale of the text
shadowif shadow is enabled (true/false)

FeatherCore.Render:DrawText(pos, text, color, scale, shadow)

Example Usage:

lua
CreateThread(function()
    while  true  do
        Wait(0)
        local onScreen, _x, _y = GetScreenCoordFromWorldCoord(GetEntityCoords(PlayerPedId()))

        if onScreen then
            FeatherCore.Render:DrawText(vector2(_x, _y), 'Feather Rules!', {r: 255, g: 0, b: 0, a: 255}, 1.0, false)
        end
    end
end)
CreateThread(function()
    while  true  do
        Wait(0)
        local onScreen, _x, _y = GetScreenCoordFromWorldCoord(GetEntityCoords(PlayerPedId()))

        if onScreen then
            FeatherCore.Render:DrawText(vector2(_x, _y), 'Feather Rules!', {r: 255, g: 0, b: 0, a: 255}, 1.0, false)
        end
    end
end)

Draw Text 3D

Draw 3D Text on screen

ParameterDescription
xx coord
yy coord
zz coord
texttext to display
scalescale of the text
colortable of rgba values
fontfont of the text (1-16) Default: 1
backgroundbackground of the text (0-64) Default: 0

FeatherCore.Render:Draw3DText(pos, text, scale, color, font, background)

Example Usage:

lua
CreateThread(function()
    while  true  do
        Wait(0)
        local playerCoords = GetEntityCoords(PlayerPedId())
        FeatherCore.Render.Draw3DText(vector3(x, y, z), 'This will show at the coords', 0.2)
    end
end)
CreateThread(function()
    while  true  do
        Wait(0)
        local playerCoords = GetEntityCoords(PlayerPedId())
        FeatherCore.Render.Draw3DText(vector3(x, y, z), 'This will show at the coords', 0.2)
    end
end)