How to draw dashed lines and rectangles?


#1

Hello,

Is there a way to draw dashed lines or filling patterns in sdl 2?

regards


#2

To my knowledge there is no way to do either of these in SDL 2. The dotted/dashed lines I have created in the past had to be custom made.


#3

This might be kind of late for an answer, but…
It depends what you mean. Do you mean, like, a straight dashed line? And do you want dashed rectangles?
Full rectangles can be drawn with SDL_FillRect() or SDL_RenderFillRect().
If you want to fill the borders of a rect, use SDL_RenderDrawRect().
But for dashed lines and rectangles, you will need custom functions.


#4

no just the contours


#5

If you want to draw the contours of a rectangle, use SDL_RenderFillRect().
And do you want a straight dashed line or will it be of arbitrary slope?