Skip to content

Commit 76ff8dc

Browse files
author
Timothy Tamm
authored
Test branch (#30)
* test * added_level_indicator * added_level_indicator * factor line drawing out into a separate function * remove comment
1 parent 006db33 commit 76ff8dc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

navball/navball.py

+6
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,16 @@ def _get_view(self, yaw, pitch):
7676

7777
return np.rot90(np.fliplr(dst))
7878

79+
def _draw_level_indicator(self):
80+
pygame.draw.lines(self.display, (255, 255, 255), False, [[self.x - self.x/8, self.y], [self.x - self.x/15, self.y], [self.x, self.y + self.y/18], [self.x + self.x/15, self.y], [self.x + self.x/8, self.y]], 3)
81+
pygame.draw.line(self.display, (255, 255, 255), [self.x - self.x/50, self.y], [self.x + self.x/50, self.y], 3)
82+
83+
7984
def draw(self, yaw, roll, pitch):
8085
ball = self._get_view(yaw, pitch)
8186
surf = pygame.surfarray.make_surface(ball)
8287
rotated_surf = pygame.transform.rotate(surf, roll)
8388
rotated_rect = rotated_surf.get_rect()
8489
rotated_rect.center = (self.x, self.y)
8590
self.display.blit(rotated_surf, rotated_rect)
91+
self._draw_level_indicator()

0 commit comments

Comments
 (0)