Reputation: 1967
My question is simple: What is the difference between using pygame.draw
and pygame.gfxdraw
? I've looked on the pygame documentation, but no one has told what the difference between them is.
Upvotes: 7
Views: 4477
Reputation: 1289
The draw
function is a bit more stable, and also a bit faster that gfxdraw
, although gfxdraw
has more options, not only along the lines of antialiasing, but also drawing shapes. pygame.draw
has only nine functions, whereas pygame.gfxdraw
has 22 options, which include all 9 of the options supplied by draw
. I recommend using gfxdraw
even though its is "experimental" because it has more capabilities.
Upvotes: 9
Reputation: 7511
gfxdraw
allows anti-aliasing for all shapes, where draw
only adds antialiasing to lines. I use gfxdraw
by default. It has been marked 'experimental' for a long time now, but I've not had any issues.
Upvotes: 3
Reputation: 1974
Disclaimer: I Don't use pygame!
According to the gfxdraw doc page, it "Wraps SDL_gfx primatives", and so offers it as an API for those already familiar with it. It also appears to offers a little bit more than the more primitive normal draw
. There also appears to be a few semantic differences here and there, so you'll need to compare each to its closest counterpart, and not assume anything.
As a final note, gfxdraw is experimental, and you should always take that into consideration before using it.
I hope this helps! :)
Upvotes: 1