23 lines
767 B
Python
23 lines
767 B
Python
import pygame
|
|
|
|
CUBE_SIZE=128
|
|
WIDTH = 1024
|
|
HEIGHT = 512
|
|
BLACK=(0,0,0)
|
|
BORDER_COLOR=BLACK
|
|
BORDER_THICKNESS=1 #Has to be INT value
|
|
class Slot:
|
|
def __init__(self,x_axis,y_axis,color,screen): #TODO crop and related to it things handling. for now as a place holder crop=>color
|
|
self.x_axis=x_axis
|
|
self.y_axis=y_axis
|
|
self.color=color
|
|
self.screen=screen
|
|
self.field=pygame.Rect(self.x_axis*CUBE_SIZE,self.y_axis*CUBE_SIZE,CUBE_SIZE,CUBE_SIZE)
|
|
def draw(self):
|
|
pygame.draw.rect(self.screen,self.color,self.field,0) #Draw field
|
|
pygame.draw.rect(self.screen,BLACK,self.field,BORDER_THICKNESS) #Draw border
|
|
pygame.display.update()
|
|
def color_change(self,color):
|
|
self.color=color
|
|
self.draw()
|