import pygame from util.ConfigurationManager import ConfigurationManager class Well: WIDTH = 10 # standard tetris well width, should not be changed HEIGHT = 20 # standard tetris well height, should not be changed def __init__(self, position): self.points = self.__get_points(position) def draw(self, surface): well_color_hex = ConfigurationManager.configuration["color"]["border"] # TODO Should abstract out color call? well_color = pygame.Color(well_color_hex) for sub_points in self.points: pygame.draw.polygon(surface, well_color, sub_points, 0) def __get_points(self, position): tile_size = ConfigurationManager.configuration["engine"]["tile-size"] shape = [] for i in range(self.WIDTH + 2): for j in range(self.HEIGHT + 2): if i == 0 or i == self.WIDTH + 1: shape.append(((i, j), (i + 1, j), (i + 1, j + 1), (i, j + 1))) elif j == 0 or j == self.HEIGHT + 1: shape.append(((i, j), (i + 1, j), (i + 1, j + 1), (i, j + 1))) points = [] for square in shape: sub_points = [] for vertex in square: point = [vertex[0] * tile_size + position[0], vertex[1] * tile_size + position[1]] sub_points.append(point) points.append(sub_points) return points