-
-
Notifications
You must be signed in to change notification settings - Fork 193
Shim and deprecate pygame.gfxdraw using pygame.draw #3006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Marking draft then. |
Hello, You did a good work ! I have extra things to say :
|
My take on this is that SDL_gfx is a vendored library, so deleting parts of its source code isn't what we should be after. If that's true, then I don't see why a partial shim helps us much. It would need to be a full replacement to delete the gfxdraw source. Maybe there's some benefit to just removing the Python->C layer for the function we no longer need with a partial shim? That being said, maybe I'm wrong. Deleting parts of their code does reduce the amount of code that needs to get compiled with SDL3. - Although, I have had barely any issues getting it to compile. Like all the patches it needed (last time I checked with SDL3) have already been added. This is definitely a good exercise to see what draw needs. I just don't know if there's a good reason to merge a partial shim. |
@Starbuck5 alright, maybe a partial shim isn't a good option. Draw is only missing bezier, aaellipse and aapolygon, so with a bit of effort we can soon enough shim it all. This pr could stay draft while me and other members port the missing functions and at that point all vendored code is removed and only the python shim remains. Textured polygon can already be added to the shim. @bilhox proposed to deprecate pie as it can be achieved with other draw functions. What do you think?
Thanks for the review. |
After some discussion, pull request #3010 closes this one as not planned. |
Functions that need to be ported to complete it:
PR will be ready to review when the deprecation is 100% complete
[WARNING: the diff looks huge, but it's really just removing useless things! Don't be scared :(]
This could potentially fix this issues: #1487, #2450, #2463 and start fixing #172 .
gfxdraw
is a dying module,draw
is just so much better, and this creates a lot of duplicates.gfxdraw
should become deprecated, and until the functions are removed (maybe) they should be implemented with the draw module in a python file. This is not possible 100% right now as there are functions with no equivalent, but this is the start of the shim. Everytime something is added, more shim is added until it's 100% python.In this PR I renamed old
gfxdraw
to_gfxdraw
(will be removed at the end of the deprecation), createdgfxdraw.py
and impllemented most of the functions (the stub is almost intact, the user shouldn't know about shims). I then went in_gfxdraw.c
and removed all non necessary functions. Finally, I removed a LOT of code from thesrc_c/SDL_gfx/
folder, everything that is not needed in the current state. I also removed a useless file which we won't need since gfxdraw is not going to grow.[REVIEW WARNING: it seems like I added code to _gfxdraw.c and the SDL_gfx files but I did not. I only removed code!]
I am working to fix the tests.
NOTE: the signature in the
@deprecated
decorator for stubs and py files must be different otherwise the raised message will seem incomplete.