Fetch pygame polys from ray manager.
[tabakrolletjie.git] / tabakrolletjie / rays.py
index d6d0a695db90556a29f98ffc958798aac5e8c2a8..f7e69cc32d36b27c502daeba340ab307adaa32c5 100644 (file)
@@ -67,6 +67,9 @@ class RayPolyManager(object):
     def polys(self):
         return [rp.poly(self._body, self._ray_filter) for rp in self._rays]
 
+    def pygame_polys(self, surface):
+        return [rp.pygame_poly(surface) for rp in self._rays]
+
 
 class RayPoly(object):
     def __init__(self, start, end, vertices):
@@ -78,3 +81,9 @@ class RayPoly(object):
         shape = pymunk.Poly(body, self.vertices)
         shape.filter = filter
         return shape
+
+    def pygame_poly(self, surface):
+        return [
+            pymunk.pygame_util.to_pygame(v, surface)
+            for v in self.vertices
+        ]