forked from s452751/AI_PRO
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
from Main.constants import *
|
|
import pygame
|
|
|
|
def drawUI(board, display, tractor_horizontal_index, tractor_vertical_index):
|
|
makeField(board, display)
|
|
drawTractor(display, tractor_horizontal_index, tractor_vertical_index)
|
|
|
|
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.state == 0:
|
|
color = WHITE
|
|
elif field.state == 1:
|
|
color = RED
|
|
elif field.state == 2:
|
|
color = YELLOW
|
|
elif field.state == 3:
|
|
color = GREEN
|
|
elif field.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])
|