36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
from Main.constants import *
|
|
import pygame
|
|
|
|
|
|
def drawUI(board, display, tractor_horizontal_index, tractor_vertical_index):
|
|
display.fill(WHITE)
|
|
makeField(board, display)
|
|
drawTractor(display, tractor_horizontal_index, tractor_vertical_index)
|
|
pygame.display.update()
|
|
|
|
|
|
def makeField(board, display):
|
|
color = BLACK
|
|
for i in range(int(HORIZONTAL_TILES_NUMBER)):
|
|
for j in range(int(VERTICAL_TILES_NUMBER)):
|
|
field = board[i][j]
|
|
|
|
if field.get_state() == 0:
|
|
color = WHITE
|
|
elif field.get_state() == 1:
|
|
color = RED
|
|
elif field.get_state() == 2:
|
|
color = YELLOW
|
|
elif field.get_state() == 3:
|
|
color = GREEN
|
|
elif field.get_state() == 4:
|
|
color = BLACK
|
|
pygame.draw.rect(display, color,
|
|
[i * TILE_SIZE, j * TILE_SIZE, TILE_SIZE, TILE_SIZE])
|
|
|
|
|
|
def drawTractor(display, tractor_horizontal_index, tractor_vertical_index):
|
|
pygame.draw.rect(display, BLACK,
|
|
[tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE, TRACTOR_WIDTH,
|
|
TRACTOR_HEIGHT])
|