1
0
Fork 0
Verteiltesystheme-game-of-life/Code/UI/Square.py
verde4321 877b0ff9a6 init
2022-03-20 13:22:19 +01:00

22 lines
564 B
Python

import pygame
from Code.Config import Colors, SquareConfig
class Square:
def __init__(self, x_pos, y_pos):
self.rect = pygame.Rect(x_pos, y_pos, SquareConfig.width, SquareConfig.height)
self.color = SquareConfig.unclicked_color
self.active = False
def update(self, active):
self.active = active
if active:
self.color = SquareConfig.clicked_color
else:
self.color = SquareConfig.unclicked_color
def draw(self, window):
pygame.draw.rect(window, self.color, self.rect)