Draw rounded shapes with ease. RNDX is a lightweight and efficient library designed to make drawing rounded shapes simple, fast, and visually stunning.
Using Shader Model 3.0, RNDX provides near-perfect anti-aliasing with no performance hit, allowing you to create beautiful interfaces and visuals with ease.
- Blazing Fast Performance: Optimized for speed, RNDX is incredibly lightweight and efficient. (It will get even faster once we get
mat:SetFloat4()
!) - Perfect Anti-Aliasing: Enjoy smooth, pixel-perfect corners with no performance hit.
- Simple & Intuitive: No complex objects or states—just call a function and draw!
- Seamless Integration: Works flawlessly inside
3D2D
andPanel:Paint*
functions without any hacks.
- Download
rndx.lua
from GitHub releases. - Add
rndx.lua
to your project. - Run
include
onrndx.lua
. (It's already callsAddCSLuaFile
for you!) - Voilà! You're ready to draw rounded shapes with ease. 🎉
local RNDX = include("rndx.lua")
hook.Add("HUDPaint", "RNDX Example", function()
local flags = RNDX.NO_TL + RNDX.NO_TR + RNDX.SHAPE_IOS
RNDX.Draw(10, 100, 100, 200, 200, nil, flags + RNDX.BLUR)
RNDX.Draw(10, 100, 100, 200, 200, Color(255, 0, 0, 150), flags)
RNDX.DrawOutlined(10, 100, 100, 200, 200, Color(0, 255, 0), 10, flags)
end)
RNDX.NO_TL
: Disables top-left corner.RNDX.NO_TR
: Disables top-right corner.RNDX.NO_BL
: Disables bottom-left corner.RNDX.NO_BR
: Disables bottom-right corner.RNDX.BLUR
: Use blur for the shape.RNDX.MANUAL_COLOR
: Allows setting the color viasurface.SetDrawColor
.
RNDX.SHAPE_CIRCLE
RNDX.SHAPE_FIGMA
<-- DefaultRNDX.SHAPE_IOS
Feature | RNDX | Circles | paint | melonstuff |
---|---|---|---|---|
Speed | ⚡ Extremely Fast | 🐌 Slow with many circles | ⚡ Fast | 🐌 Slow |
Anti-Aliasing | ✅ Perfect, no performance cost | ❌ None | ❌ Poor (Source Engine AA) | ❌ None |
Ease of Use | 🎯 Simple & Minimal | 🎯 Simple | 🧩 Complex & Bloated | 🎯 Easy |
Documentation | 📖 Clear & Concise | 📖 Good | ❌ Overwhelming & Undocumented | 📖 Good |
Benchmarking has to be done with FPS meter, not checking how long cpu takes to draw.
local RNDX = include("rndx.lua")
local draw_RoundedBox = draw.RoundedBox
local col = Color(0, 0, 0, 255)
hook.Add("HUDPaint", "my_shader_draw", function()
for i = 1, 3000 do
RNDX.Draw(20, 20, 20, 200, 200, col)
-- draw_RoundedBox(20, 20, 20, 200, 200, col)
end
end)
RNDX
: 140 FPSdraw.RoundedBox
: 43 FPS
150 Calls
x y w h
of 10, 10, 700, 700
Current RNDX
: 107 fpsPrevious RNDX
: 73 fps- https://pastebin.com/urx4Qvez : 59 fps
RNDX is open-source and free to use. Feel free to contribute or report issues on GitHub!
Make sure to give credits!
- ficool2 - For sdk_screenspace_shaders & finding out that we can use shaders in source engine games!
- Rubat - For allowing us to use shaders in Garry's Mod!
- Svetov/Jaffies/FriendlyStealer - For lots of help throughout the development of RNDX! Also suggested multiple stuff to improve the performance!
- Shadertoy Rounded Code
- Shadertoy Blur Code
- And AI because I don't understand how shaders work!
RNDX: Because drawing rounded shapes should be simple, fast, and beautiful. 🎉