Пример #1
0
 def draw_message(self):
     if event.message != self.current_message:
         self.current_message = event.message
         self.message_label.text = event.message
         self.message_label.font_size = event.message_size
     xa = self.message_label.content_width // 2 + 20
     ya = self.message_label.content_height // 2 + 5
     gl.glLineWidth(3.0)
     gl.glPointSize(1.0)
     draw.set_color(0, 0, 0, 0.8)
     draw.rect(
         self.message_label.x - xa, self.message_label.y - ya, self.message_label.x + xa, self.message_label.y + ya
     )
     draw.set_color(0, 0, 0, 1)
     draw.rect_outline(
         self.message_label.x - xa, self.message_label.y - ya, self.message_label.x + xa, self.message_label.y + ya
     )
     draw.points(
         (
             self.message_label.x - xa,
             self.message_label.y - ya,
             self.message_label.x + xa,
             self.message_label.y - ya,
             self.message_label.x + xa,
             self.message_label.y + ya,
             self.message_label.x - xa,
             self.message_label.y + ya,
         )
     )
     self.message_label.draw()
Пример #2
0
 def draw(self):
     if self.selected:
         draw.set_color(0, 1, 0, 1)
         x1, y1 = self.x - 5, self.y + 13
         x2 = self.lineto_x + player_position[0]
         y2 = self.lineto_y + player_position[1]
         draw.rect_outline(
             x2 - physics.default_radius * 1.3,
             y2 - physics.default_radius * 1.3,
             x2 + physics.default_radius * 1.3,
             y2 + physics.default_radius * 1.3,
         )
     super(UnitProxyButton, self).draw()