Jump to content

View more

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

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

4: Adsense

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   

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.


#2 SeanMiddleditch   Members   

17467
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.

Game Developer, C++ Geek, Dragon Slayer - http://seanmiddleditch.com

C++ SG14 "Games & Low Latency" - Co-chair - public forums

Wargaming Seattle - Lead Server Engineer - We're hiring!


#3 Zanman777   Members   

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+   

10813
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.


Hello to all my stalkers.




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.