1
0
Fork 0
ProjektAI/kelner/src/components/GridBoard.py

24 lines
888 B
Python

import pygame
class GridBoard:
def __init__(self, width, height, cellSize):
pygame.init() #initialize the pygame
pygame.display.set_caption("Bardzo mądry kelner") #window caption
self.__width = width
self.__height = height
self.__cellSize = cellSize
self.__screen = pygame.display.set_mode((width, height)) #initialize screen
def reinitialize(self):
self.__screen.fill((255, 255, 255))
for x in range(0, self.__width, self.__cellSize):
pygame.draw.line(self.__screen, (0,0,0), (x,0), (x,(self.__height - 1)))
for y in range(0, self.__height, self.__cellSize):
pygame.draw.line(self.__screen, (0,0,0), (0,y), ((self.__width - 1),y))
def draw(self, component):
component.draw(self.__screen)
def udpdate(self):
pygame.display.update()