| | 732 | class HUDShipInfoLite(HUDInfoPanel): |
| | 733 | """Heads-up ship status display (lightweight version).""" |
| | 734 | |
| | 735 | def __init__(self, ship, font, xalign=0, yalign=0, |
| | 736 | colors=HUDInfoPanel.STD_COLORS): |
| | 737 | HUDInfoPanel.__init__(self, font, 12, 1.75, xalign, yalign, colors) |
| | 738 | self.ship = ship |
| | 739 | self.surface.set_alpha(255) # should be faster, I hope |
| | 740 | |
| | 741 | def draw(self, surface): |
| | 742 | self.draw_rows(surface, |
| | 743 | ('frags', '%d' % self.ship.frags),) |
| | 744 | x, y = self.position(surface) |
| | 745 | x += 1 |
| | 746 | y += self.height - 5 |
| | 747 | w = max(0, int((self.width - 4) * self.ship.health)) |
| | 748 | pygame.draw.rect(surface, self.color2, (x, y, self.width-2, 4), 1) |
| | 749 | surface.fill(self.color1, (x+1, y+1, w, 2)) |
| | 750 | |
| | 751 | |
| 2198 | | self.hud = HUDCollection([ |
| 2199 | | HUDShipInfo(self.ships[0], self.hud_font, 1, 0), |
| 2200 | | HUDShipInfo(self.ships[1], self.hud_font, 0, 0, |
| 2201 | | HUDShipInfo.GREEN_COLORS), |
| 2202 | | HUDCompass(self.game.world, self.ships[0], self.viewport, 1, 1, |
| 2203 | | HUDCompass.BLUE_COLORS), |
| 2204 | | HUDCompass(self.game.world, self.ships[1], self.viewport, 0, 1, |
| 2205 | | HUDCompass.GREEN_COLORS), |
| 2206 | | ]) |
| | 2220 | if self.lightweight_hud: |
| | 2221 | self.hud = HUDCollection([ |
| | 2222 | HUDShipInfoLite(self.ships[0], self.hud_font, 1, 0), |
| | 2223 | HUDShipInfoLite(self.ships[1], self.hud_font, 0, 0, |
| | 2224 | HUDShipInfo.GREEN_COLORS), |
| | 2225 | ]) |
| | 2226 | else: |
| | 2227 | self.hud = HUDCollection([ |
| | 2228 | HUDShipInfo(self.ships[0], self.hud_font, 1, 0), |
| | 2229 | HUDShipInfo(self.ships[1], self.hud_font, 0, 0, |
| | 2230 | HUDShipInfo.GREEN_COLORS), |
| | 2231 | HUDCompass(self.game.world, self.ships[0], self.viewport, 1, 1, |
| | 2232 | HUDCompass.BLUE_COLORS), |
| | 2233 | HUDCompass(self.game.world, self.ships[1], self.viewport, 0, 1, |
| | 2234 | HUDCompass.GREEN_COLORS), |
| | 2235 | ]) |