This submodule contains helper functions to help with quick prototyping using pymunk together with pygame.
Intended to help with debugging and prototyping, not for actual production use in a full application. The methods contained in this module is opinionated about your coordinate system and not in any way optimized.
Draw one or many pymunk objects on a pygame.Surface object.
If a Space is passed in all shapes in that space will be drawn. Unrecognized objects will be ignored (for example if you pass in a constraint).
Typical usage:
>>> pymunk.pygame_util.draw(screen, my_space)
You can control the color of a shape by setting shape.color to the color you want it drawn in.
>>> my_shape.color = pygame.color.THECOLORS["pink"]
If you do not want a shape to be drawn, set shape.ignore_draw to True.
>>> my_shape.ignore_draw = True
Not all constraints are currently drawn in a very clear way, but all the different shapes should look fine both as static and dynamic objects.
See pygame_util.demo.py for a full example
Parameters : |
|
---|
Get position of the mouse pointer in pymunk coordinates.