comparison tools/area_editor.py @ 516:b5838fb35db3

More polygon buttons
author Neil Muller <drnlmuller@gmail.com>
date Sat, 07 Sep 2013 19:48:48 +0200
parents 1b1bd4f39e5c
children 83f3a376e9a7
comparison
equal deleted inserted replaced
515:1b1bd4f39e5c 516:b5838fb35db3
882 class PolyButton(HighLightButton): 882 class PolyButton(HighLightButton):
883 """Button for coosing the correct polygon""" 883 """Button for coosing the correct polygon"""
884 884
885 def __init__(self, index, level_widget, parent): 885 def __init__(self, index, level_widget, parent):
886 if index is not None: 886 if index is not None:
887 text = "Draw: %s" % index 887 text = "P %s" % index
888 else: 888 else:
889 text = 'Exit Draw Mode' 889 text = 'Exit Draw Mode'
890 super(PolyButton, self).__init__(text, parent) 890 super(PolyButton, self).__init__(text, parent)
891 self.index = index 891 self.index = index
892 self.level_widget = level_widget 892 self.level_widget = level_widget
954 954
955 white = pygame.color.Color("white") 955 white = pygame.color.Color("white")
956 956
957 # Add poly buttons 957 # Add poly buttons
958 y = 5 958 y = 5
959 for poly in range(1, 7): 959 for poly in range(1, 10):
960 but = PolyButton(poly, self.level_widget, self) 960 but = PolyButton(poly, self.level_widget, self)
961 but.rect = pygame.rect.Rect(0, 0, MENU_WIDTH // 2 - MENU_PAD, 961 but.rect = pygame.rect.Rect(0, 0, MENU_WIDTH // 3 - MENU_PAD,
962 MENU_BUTTON_HEIGHT) 962 MENU_BUTTON_HEIGHT)
963 if poly % 2: 963 index = poly % 3
964 if index == 1:
964 but.rect.move_ip(MENU_LEFT, y) 965 but.rect.move_ip(MENU_LEFT, y)
966 elif index == 2:
967 but.rect.move_ip(MENU_LEFT + MENU_WIDTH // 3 - MENU_HALF_PAD,
968 y)
965 else: 969 else:
966 but.rect.move_ip(MENU_LEFT + MENU_WIDTH // 2 - MENU_HALF_PAD, 970 left = MENU_LEFT + 2 * MENU_WIDTH // 3 - MENU_HALF_PAD
967 y) 971 but.rect.move_ip(left, y)
968 y += MENU_BUTTON_HEIGHT + MENU_PAD 972 y += MENU_BUTTON_HEIGHT + MENU_PAD
969 self._light_buttons.append(but) 973 self._light_buttons.append(but)
970 widgets.append(but) 974 widgets.append(but)
971 975
972 end_poly_but = PolyButton(None, self.level_widget, self) 976 end_poly_but = PolyButton(None, self.level_widget, self)