Sign in to follow this  
Zanman777

Please tell me there's a way to set line width in SDL

Recommended Posts

I can't find a way to set a line width for the SDL_RenderDrawLine function, but I can't believe there's no way to set it. That's just... basic. Is there really no way to do so? Are the lines always 1 pixel wide, or what?

 

EDIT: Found an extension library (SDL_GFX) that provides that feature. It's wierd native SDL doesn't have that, though...

Edited by Zanman777

Share this post


Link to post
Share on other sites
Hardware doesn't support it since nobody seriously uses lines outside of debug uses and hence don't need width so OpenGL and D3D contexts can't support it. It can only be done with slow software rendering or with non-trivial triangularization or very specialized shader effects. This is likely why SDL doesn't support it. SDL_gfx is a software rasterizer.

Share this post


Link to post
Share on other sites

If you're using a image for the button, the border can be included in the image.

 

If not, I guess you can draw a bigger (filled) rectangle first, and then the button rectangle after? When the button rectangle overwrites the larger, you'll just be left with what looks like a border. This might be very wasteful, especially if you have many or large buttons.

Another option could be to draw 4 (filled) rectangles around the button's rectangle.

 

Just some suggestions off the top of my head, maybe they can help you achieve what you want.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this