Draw the units and buildings.

def draw_units(self, surf):
    """Draw the units and buildings."""
    for u, p in self._visible_units():
      if self._camera.intersects_circle(p, u.radius):
        fraction_damage = clamp((u.health_max - u.health) / (u.health_max or 1),
                                0, 1)
        surf.draw_circle(colors.PLAYER_ABSOLUTE_PALETTE[u.owner], p, u.radius)

        if fraction_damage > 0:
          surf.draw_circle(colors.PLAYER_ABSOLUTE_PALETTE[u.owner] // 2,
                           p, u.radius * fraction_damage)

        if u.shield and u.shield_max:
          surf.draw_arc(colors.blue, p, u.radius, 0,
                        2 * math.pi * u.shield / u.shield_max)
        if u.energy and u.energy_max:
          surf.draw_arc(colors.purple * 0.75, p, u.radius - 0.05, 0,
                        2 * math.pi * u.energy / u.energy_max)

        name = self.get_unit_name(
            surf, self._static_data.units.get(u.unit_type, "<none>"), u.radius)
        if name:
          text = self._font_small.render(name, True, colors.white)
          rect = text.get_rect()
          rect.center = surf.world_to_surf.fwd_pt(p)
          surf.surf.blit(text, rect)

        if u.is_selected:
          surf.draw_circle(colors.green, p, u.radius + 0.1, 1)