pymunk.pygame_util
Module¶
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.
-
class
pymunk.pygame_util.
DrawOptions
(surface)[source]¶ Bases:
pymunk.space_debug_draw_options.SpaceDebugDrawOptions
-
DRAW_COLLISION_POINTS
¶ alias of
CP_SPACE_DEBUG_DRAW_COLLISION_POINTS
-
DRAW_CONSTRAINTS
¶ alias of
CP_SPACE_DEBUG_DRAW_CONSTRAINTS
-
DRAW_SHAPES
¶ alias of
CP_SPACE_DEBUG_DRAW_SHAPES
-
__init__
(surface)[source]¶ Draw a pymunk.Space on a pygame.Surface object.
Typical usage:
>>> options = pymunk.pygame_util.DrawOptions(screen) >>> myspace.debug_draw(options)
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"]
See pygame_util.demo.py for a full example
Parameters: - surface : pygame.Surface
Surface that the objects will be drawn on
-
collision_point_color
¶
-
color_for_shape
(shape)¶
-
constraint_color
¶
-
flags
¶
-
shape_dynamic_color
= SpaceDebugColor(r=52, g=152, b=219, a=255)¶
-
shape_kinematic_color
= SpaceDebugColor(r=39, g=174, b=96, a=255)¶
-
shape_outline_color
¶
-
shape_sleeping_color
= SpaceDebugColor(r=114, g=148, b=168, a=255)¶
-
shape_static_color
= SpaceDebugColor(r=149, g=165, b=166, a=255)¶
-
-
pymunk.pygame_util.
get_mouse_pos
(surface)[source]¶ Get position of the mouse pointer in pymunk coordinates.