easymunk.pygame
Module¶
This submodule contains helper functions to help with quick prototyping using easymunk 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
easymunk.pygame.
DrawOptions
(surface=None, flip_y=False)[source]¶ Bases:
easymunk.drawing.DrawOptions
-
surface
: None.Surface¶
-
draw_circle
(pos, radius, angle=0.0, outline_color=Color(255, 0, 0, 255), fill_color=Color(255, 0, 0, 255))[source]¶ Draw circle from position, radius, angle, and colors.
- Return type
None
-
draw_fat_segment
(a, b, radius=0.0, outline_color=Color(255, 0, 0, 255), fill_color=Color(255, 0, 0, 255))[source]¶ Draw fat segment/capsule.
- Return type
None
-
draw_polygon
(verts, radius=0.0, outline_color=Color(255, 0, 0, 255), fill_color=Color(255, 0, 0, 255))[source]¶ Draw polygon from list of vertices.
- Return type
None
-
DRAW_COLLISION_POINTS
= 4¶ Draw collision points.
Use on the flags property to control if collision points should be drawn or not.
-
DRAW_CONSTRAINTS
= 2¶ Draw constraints.
Use on the flags property to control if constraints should be drawn or not.
-
DRAW_SHAPES
= 1¶ Draw shapes.
Use on the flags property to control if shapes should be drawn or not.
-
property
collision_point_color
¶ The color of collisions.
Should be a tuple of 4 ints between 0 and 255 (r, g, b, a).
-
property
constraint_color
¶ The color of constraints.
Should be a tuple of 4 ints between 0 and 255 (r, g, b, a).
-
draw_circle_shape
(circle)[source]¶ Default implementation that draws a circular shape.
This function is not affected by overriding the draw method of shape.
- Return type
None
-
draw_poly_shape
(shape)[source]¶ Default implementation that draws a polygonal shape.
This function is not affected by overriding the draw method of shape.
- Return type
None
-
draw_segment_shape
(shape)[source]¶ Default implementation that draws a segment shape.
This function is not affected by overriding the draw method of shape.
- Return type
None
-
property
flags
¶ Bit flags which of shapes, joints and collisions should be drawn.
By default all 3 flags are set, meaning shapes, joints and collisions will be drawn.
Example using the basic text only DebugDraw implementation (normally you would the desired backend instead, such as pygame_util.DrawOptions or pyglet_util.DrawOptions):
-
shape_dynamic_color
= Color(52, 152, 219, 255)¶
-
shape_kinematic_color
= Color(39, 174, 96, 255)¶
-
property
shape_outline_color
¶ The outline color of shapes.
Should be a tuple of 4 ints between 0 and 255 (r, g, b, a).
-
shape_sleeping_color
= Color(114, 148, 168, 255)¶
-
shape_static_color
= Color(149, 165, 166, 255)¶
-