- Notifications
You must be signed in to change notification settings - Fork3.8k
Addspecial_flags argument toGroup.draw#3722
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
illume commentedFeb 19, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thanks :)
In my humble opinion, it would make sense for the DirtyLayered to support this, since it is a subclass. Probably all the subclasses that come with pygame should support it? |
illume commentedFeb 19, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Looks like the file needs formatting with the black formatter. python3 -m pip install black --userpython3 -m black src_py |
illume commentedFeb 19, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There’s a type issue here: cd buildconfig/stubspython3 -m pip install mypy --userpython3 -m mypy.stubtest pygame --allowlist mypy_allow_list.txt |
This is not perfect as `Group.dirty` has this as 2nd argument but this has it as 3rd argument.
The problem is that defdraw(self,surface:Surface,special_flags:int=0)->List[Rect]: ... but defdraw(self,surface:Surface,bgd:Optional[Surface]=None,special_flags:int=0)->List[Rect]: ... so code that takes any instance of I can thing of 2 solutions:
|
I'm a fan of your second solution (except rename bgd to Do you see any drawbacks with this solution 2? (I couldn't find any code using a bgd keyword argument, so I think it's safe to rename) Q: Is a blendmode(special_flags) attribute on sprite would be better here? IMHO, No. I think there's a use case where we want the special_flags to be used for the whole group. It's more convenient when you want everything to use the same |
I agree that special_flags should be used for the whole group. Because then it will be consistent with all the other groups as the special_flags argument will always apply to everything in the group (and that won't depend on if its a normal |
Looks like there's a couple of pylint issues: |
(the arguments should now be the same across all `Group.draw` functions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍 thanks
The pygame compatibility bugs with python 3.7 were first introduced inpygame 2.1.3.dev6 (pygame/pygame@a462721e) and were fully resolved in2.2.0.dev2 (pygame/pygame#3723,pygame/pygame#3722,pygame/pygame@aab517c7).So we can relax the requirement tightened ininstadeepai#67(instadeepai/jumanji#7dcd89f8) and just exlude 2.1.3.
…-argAdd `special_flags` argument to `Group.draw`
I've added the
special_flagsargument to all theGroups exceptDirtyLayeredtofix#3719.I'm not sure whether to add the
special_flagsargument toDirtyLayeredasDirtyLayeredalready partially handles this with theblendmodeattribute on theDirtySpriteobjects.