Textures - lnx00/Lmaobox-Library GitHub Wiki

lnxLib.UI.Textures

⚠️ Some functions are deprecated and have been implemented natively in the Lmaobox API! Use the official functions instead for the best performance.

Allows you to generate various types of textures. Please note that generating textures is performance intensive and should only be done once when starting your script!

size is a table with 2 items: width and height

color is a table with 3 (or 4) entries: r, g, b (and optionally alpha)

Functions

  • .LinearGradient(startColor, endColor, size) Generates a linear gradient. You should use draw.FilledRectFade(...) instead.
  • .Circle(radius, color) Generates a circle texture with the given radius. You should use draw.ColoredCircle(...) instead.

Examples

local circleTexture = UI.Textures.Circle(50, { 255, 0, 0, 255 })
local gradientTexture = UI.Textures.LinearGradient({ 5, 115, 230 }, { 0, 25, 120 }, { 128, 128 })

function Draw()
  local w, h = draw.GetTextureSize(circleTexture)
  draw.TexturedRect(circleTexture, 200, 200, 200 + w, 200 + h)

  draw.TexturedRect(gradientTexture , 200, 400, 200 + 128, 400 + 128)
end

Circle Gradient