Skip to content

Conversation

@SleepProgger
Copy link
Contributor

This PR mainly exposes the cymunk layers and the offset for BoxShapes (kivy/cymunk#49).
This PR will break BoxShapes for user with old cymunk versions (before the above PR) !
It might be wise to split this PR into two ?

To make using the layers (a bitset) a bit easier i added the LayerHelper class which allows mapping of layer names to bits.
The shape_info dict may now contain a layers key which holds an iterable of registered layer names or an int representing the bitset.
I am not sure if the LayerHelper should live in kivent or cymunk.

Other changes:

  • Made all offsets optional. Defaulting to (0,0)
  • Removed outdated info from init_components doc string.

@SleepProgger
Copy link
Contributor Author

Sorry, missed some debug prints i left in the code.

Additionally i forgot to mention that the CymunkPhysics.init_component functions now raises an ValueError if the shape_type is invalid.

Also, i am wondering: Is PhysicsComponent.shape_type used for anything at all ?
I searched and didn't found anything where its used.
I'd propose to a.) remove it or b.) Remove the _shape_type variable but keep the getter property which could simply return the type of the first shape. I don't see for what tho tbh.

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.

1 participant