Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Zanman777   Members   -  Reputation: 219

Like
1Likes
Like

Posted 17 December 2013 - 01:09 PM

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, 17 December 2013 - 01:15 PM.


Sponsor:

#2 SeanMiddleditch   Members   -  Reputation: 6454

Like
1Likes
Like

Posted 17 December 2013 - 02:50 PM

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.

#3 Zanman777   Members   -  Reputation: 219

Like
0Likes
Like

Posted 18 December 2013 - 08:36 AM

My purpose was to draw buttons' borders. There is no way to specify the SDL_Rect border width, so I was trying the line approach. How can I draw a customisable button border, then?



#4 Lactose!   GDNet+   -  Reputation: 3615

Like
0Likes
Like

Posted 18 December 2013 - 08:48 AM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS