from Main.constants import * from Main.images import * import pygame def drawUI(board, display, tractor_horizontal_index, tractor_vertical_index): display.fill(WHITE) makeField(board, display) drawTractor(display, tractor_right, tractor_horizontal_index, tractor_vertical_index) pygame.display.update() def makeField(board, screen: pygame.Surface): for i in range(int(HORIZONTAL_TILES_NUMBER)): for j in range(int(VERTICAL_TILES_NUMBER)): field = board[i][j] pos_x = i * TILE_SIZE + TILE_SIZE // 2 pos_y = j * TILE_SIZE + TILE_SIZE // 2 if field.state == 0: do_podlania_rect.center = (pos_x, pos_y) screen.blit(do_podlania, do_podlania_rect) elif field.state == 1: do_zaorania_rect.center = (pos_x, pos_y) screen.blit(do_zaorania, do_zaorania_rect) elif field.state == 2: do_zasiania_rect.center = (pos_x, pos_y) screen.blit(do_zasiania, do_zasiania_rect) elif field.state == 3: do_zebrania_rect.center = (pos_x, pos_y) screen.blit(do_zebrania, do_zebrania_rect) def drawTractor(screen: pygame.Surface, tractor_image, tractor_horizontal_index, tractor_vertical_index): screen.blit(tractor_image, (tractor_horizontal_index * TILE_SIZE,tractor_vertical_index * TILE_SIZE))