def __init__(self, screen_size, actor_list, color=None): border_gap = 50 box_size = pygame.Rect(border_gap, border_gap, screen_size[0] - border_gap * 2, screen_size[1] - border_gap * 2) Box.__init__(self, box_size, color) self.actor_list = actor_list self.options = SelectBox(box_bounds=pygame.Rect( (box_size.width / 3) * 2, box_size.top, box_size.width / 3 - border_gap, box_size.height - border_gap * 2), color=(80, 80, 150)) self.options.options = [{ "NAME": "Stats", "ACT": "PASS" }, { "NAME": "Order", "ACT": "PASS" }, { "NAME": "Items", "ACT": "PASS" }, { "NAME": "Save", "ACT": "SAVE" }, { "NAME": "Exit", "ACT": "EXIT" }] self.options.open()
def __init__(self, screen_size, text=None, color=None, font_size=None): if font_size is None: font_size = 24 box_height = font_size * 2 + 48 box_width = len(text) * font_size + 20 + 48 box_bounds = pygame.Rect(screen_size[0] / 2 - box_width / 2, screen_size[1] / 2 - box_height / 2, box_width, box_height) Box.__init__(self, box_bounds=box_bounds, color=color, font_size=font_size) self.text = text Box.open(self, color=color)
def __init__(self, box_bounds, text=None, color=None, picture=None): Box.__init__(self, box_bounds, color) self.text = text self.portrait = self.get_image(picture) self.background = None self.choice = False self.choice_box = pygame.Rect(self.box.right - self.box.width / 3 - 10, self.box.top - 100, self.box.width / 3, self.font_size * 2 + self.space * 3) self.choice_inner_box = pygame.Rect( self.choice_box.left + self.border, self.choice_box.top + self.border, self.choice_box.width - self.border * 2, self.choice_box.height - self.border * 2)
def __init__(self, box_bounds, color=None): Box.__init__(self, box_bounds, color) self.options = [] self.position = 0