Skip to content

Background class, and 5 examples.#1197

Merged
einarf merged 16 commits intopythonarcade:2.7from
DragonMoffon:backgrounds
Apr 28, 2022
Merged

Background class, and 5 examples.#1197
einarf merged 16 commits intopythonarcade:2.7from
DragonMoffon:backgrounds

Conversation

@DragonMoffon
Copy link
Collaborator

@DragonMoffon DragonMoffon commented Apr 22, 2022

The push Implements a background class, and BackgroundTexture, BackgroundGroup, and ParallaxGroup. Plus five examples: static Background, scrolling Background, BackgroundGroup, ParallaxGroup, and Blending between Backgrounds.

These close #1152 and #991

@einarf
Copy link
Member

einarf commented Apr 22, 2022

Some quick intial comments. This actually looks really solid, but I am not 100% sure about the details around what properties should be on the texture and the background itself to give the most flexbility.

Also there are missing some type annotations here, but I think fixing the more obvious things and just merging it is a better approach here. Play around with the feature and tweak things instead.

Adding a RGBA color multiplier can also add a lot of flexiblity here instead of just blend. We can really merge this as it is now to be honest. Knitpicking on smaller things that are subject to change around a little bit won't move us forward.

@DragonMoffon
Copy link
Collaborator Author

DragonMoffon commented Apr 27, 2022

For the colour should, do you think I should apply via multiply or addition? Currently, have it as multiply, but if someone wanted to fade in the color, it would be easier if it was added.

Also, I have it supporting both normalised and not, but I decide if the colour is normalised by seeing if the sum of the colour is less than or equal to 3, which may cause some confusing bugs. Is there a better way of deciding?

@einarf
Copy link
Member

einarf commented Apr 27, 2022

  • We do color multiplication everywhere in arcade right now, so that would make the most sense
  • If you want to support byte RGBA and normalized RGBA color they can have different properties. color, color_normalized

…tation. made backgrounds in BackgroundGroup and ParallaxGroup 'private'. Gave them __get_item__, __set_item__, and __iter__.

The color was added as RGB with blending separate. Mainly because it makes the purpose of the variable clearer. It is meant to be used for blending between backgrounds, as such I think it should stay as it is. This can be changed if people disagree.
@DragonMoffon
Copy link
Collaborator Author

Some of the functions are still missing docstrings. Which will need to be fixed before 2.7 is out. But otherwise, it should be mergeable.

@einarf einarf merged commit 9983106 into pythonarcade:2.7 Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants