Пример #1
0
 def draw(self, context):
   LivingThing.draw(self, context)
   if self.show_fov: # draw field-of-view
     Ax = 0.0
     Ay = 0.0
     Bx = (self.sight_distance * math.cos(math.radians(-45.0)))
     By = -(self.sight_distance * math.sin(math.radians(-45.0)))
     Cx = (self.sight_distance * math.cos(math.radians(45.0)))
     Cy = -(self.sight_distance * math.sin(math.radians(45.0)))
     context.set_line_width(0.02)
     context.set_source_rgba(0.0, 1.0, 0.0, 0.9)
     context.move_to(Ax, Ay)
     context.line_to(Bx, By)
     context.line_to(Cx, Cy)
     context.line_to(Ax, Ay)
     context.line_to(self.sight_distance, 0.0)
     #context.rectangle(-0.5, -0.5, 1.0, 1.0)
     #context.fill()
     context.stroke()
Пример #2
0
 def draw(self, context):
   LivingThing.draw(self, context)