we have 5 different textures, each of circles with the specified radius (so the 8px corner radius texture is 16x16, for example.) the radii we actually have textures for are 8px, 16px, 32px, 64px and 128px.
when you want to draw a rounded rectangle of *any* corner radius, what you do is you find the texture with the next highest corner radius (so 8px corners would use the 8px textures, 12px corners use the 16px texture, 100px uses 128px etc.) and you simply scale the corners down to the desired radius when you copy them (using bilinear scaling to eliminate jaggies)
it's so cool. and good. and it looks very nice.
originally i had a texture for 4px corners as well but i deemed it unnecessary and hacksawed it out of the engine
one fun bonus detail is that the corner texture is compiled in since odin (the language i wrote this in) allows you to compile files in as binary data (arrays of 8-bit unsigned integers)
#gamedev #raylib










