Verteiltesystheme/Code/UI/Square.py

22 lines
564 B
Python
Raw Permalink Normal View History

2022-03-20 09:47:49 +01:00
import pygame
from Code.Config import Colors, SquareConfig
class Square:
2022-03-20 13:22:19 +01:00
def __init__(self, x_pos, y_pos):
self.rect = pygame.Rect(x_pos, y_pos, SquareConfig.width, SquareConfig.height)
2022-03-20 09:47:49 +01:00
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)