def __init__(self, position): UIObjectBase.__init__(self) self.size_control = PlayerSettingControl(position, 100, "Size") self.add_child(self.size_control) power_control_position = ( position[0], self.size_control.position[1] + self.size_control.height + 10 ) self.power_control = PlayerSettingControl(power_control_position, 100, "Power") self.add_child(self.power_control) speed_control_position = ( position[0], self.power_control.position[1] + self.power_control.height + 10 ) self.speed_control = PlayerSettingControl(speed_control_position, 100, "Speed") self.add_child(self.speed_control) weight_control_position = ( position[0], self.speed_control.position[1] + self.speed_control.height + 10 ) self.weight_control = PlayerSettingControl( weight_control_position, 200, "Weight" ) #self.add_child(self.weight_control) self.evaluate_position() self.set_dimensions()
def __init__(self, center, selected_index): global radius global swatch_radius global angle_increment UIObjectBase.__init__(self) self.swatch_center = center self.color_swatches = [] self.swatch_radius = swatch_radius self.selected_swatch = None for i in range(len(playerconstants.COLORS)): angle = angle_increment * i swatch_center = ( int(center[0] + (math.cos(angle) * radius)), int(center[1] + (math.sin(angle) * radius)) ) self.color_swatches.append( ColorSwatchCircle(playerconstants.COLORS[i], swatch_center, swatch_radius) ) self.color_swatches.append( ColorSwatchRect( (255, 255, 255), (0, 0, 0), ( int(center[0] - radius - swatch_radius), int(center[1] + radius + swatch_radius) ), int(radius + swatch_radius), int(.333 * (radius + swatch_radius)) ) ) self.color_swatches.append( ColorSwatchRect( (0, 0, 0), (255, 255, 255), ( center[0], int(center[1] + radius + swatch_radius) ), int(radius + swatch_radius), int(.333 * (radius + swatch_radius)) ) ) self.add_children(self.color_swatches) self.evaluate_position() self.set_dimensions() self.color_swatches[selected_index].handle_selected() self.selected_swatch = self.color_swatches[selected_index]
def __init__(self, position, movesets): UIObjectBase.__init__(self) self.set_layout_data(position, MovesetSelector.HEIGHT, MovesetSelector.WIDTH) self.selected_thumbnail_index = 0 self.fixed_dimensions = True MovesetLoader.__init__(self, movesets) self.selected_moveset = self.thumbnails[self.selected_thumbnail_index].moveset self.left_scroll_button = ScrollButton(SCROLL_LEFT) self.right_scroll_button = ScrollButton(SCROLL_RIGHT) self.set_scroll_button_layout_data() self.scroll_increment = 10
def __init__(self, stages, position): UIObjectBase.__init__(self) self.set_position(position) self.height = 500 self.width = 310 self.stages = stages self.thumbnails = [StageThumbnail(stage) for stage in stages] self.thumbnail_padding = 20 self.surface = pygame.Surface((self.width, self.height)) self.selected_thumbnail = None self.selected_thumbnail_target_position = [ self.position[0], self.position[1] + (.5 * self.height) - (.5 * self.thumbnails[0].height) ] self.layout_thumbnails() self.fade_top = None self.fade_bottom = None self.create_fades()