[SDL] How about an SDL_RenderFillQuad function?

Melker Narikka meklu at meklu.org
Fri Sep 30 06:11:14 PDT 2016


If you're not too worried about performance, you could draw a
rectangle into an SDL_Texture
and then draw it rotated with SDL_RenderCopyEx. Of course you'd have
to do a bit more
additional arithmetic yourself as the function takes an angle in degrees.

--
Melker Narikka

On Fri, Sep 30, 2016 at 3:37 PM, SeanOConnor <sean at windowsgames.co.uk> wrote:
> I need to draw a graph in my game but it looks like the SDL_RenderDrawLine
> only draws lines 1 pixel wide. With a bit of maths I can work out the 4
> points needed to draw a line of any width but the only SDL function that
> draws a primitive seems to be:
>
> SDL_RenderFillRect
>
> which only draws rectangles with no rotation.
>
> I'm guessing this SDL function just draws two triangles to make this
> rectangle based on the SDL_Rect it's sent, so surely it'd be trivial to
> create a new function SDL_RenderFillQuad that accepts four SDL_Points and
> draws two triangles based on that?
>
> And maybe an SDL_RenderFillTriangle too that takes three SDL_Points?
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>


More information about the SDL mailing list