Skip to content

Commit

Permalink
Saner indexing for geometric points.
Browse files Browse the repository at this point in the history
Some work for #30.
  • Loading branch information
skytreader committed Mar 28, 2018
1 parent 9068807 commit 204d962
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/common_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, label, color, position, label_font=None):
# TODO Handle labels that are too long.
size = Button.DEFAULT_FONT.size(label)
super(Button, self).__init__(
position, size[1] + Button.VPADDING, size[0] + Button.HPADDING
position, size[0] + Button.HPADDING, size[1] + Button.VPADDING
)

@property
Expand All @@ -36,6 +36,6 @@ def action(self, handler):
self.__action = handler

def draw(self, window, screen, **kwargs):
pygame.draw.rect(window, self.color, (self.position[1], self.position[0], self.max_size[1], self.max_size[0]))
pygame.draw.rect(window, self.color, (self.position[1], self.position[0], self.max_size[0], self.max_size[1]))
button_label = Button.DEFAULT_FONT.render(self.label, True, Colors.MAX_BLACK)
window.blit(button_label, (self.position[1] + int(Button.HPADDING / 2), self.position[0] + int(Button.VPADDING / 2)))

0 comments on commit 204d962

Please sign in to comment.