2020-04-06 18:24:02 +02:00
|
|
|
from typing import List
|
|
|
|
|
|
|
|
import pygame
|
|
|
|
import sys
|
|
|
|
from pygame.locals import *
|
|
|
|
import functions
|
|
|
|
import os
|
|
|
|
from config import *
|
|
|
|
|
|
|
|
pygame.init()
|
|
|
|
#Załadowanie zdjęć
|
|
|
|
|
|
|
|
|
|
|
|
#Pole tekstowe
|
|
|
|
ILE_RUCHOW = 0
|
|
|
|
|
|
|
|
#Init pola gry
|
|
|
|
okno = pygame.display.set_mode((SZER, WYS), 0, 32)
|
|
|
|
|
|
|
|
#Tytuł okna
|
|
|
|
pygame.display.set_caption(WINDOW_NAME)
|
|
|
|
|
|
|
|
#Tworzenie powierzchni pola
|
|
|
|
pole_surf = pygame.Surface([POLE_SZER,POLE_WYS])
|
|
|
|
pole_surf.fill(POLE_COL)
|
|
|
|
pole_surf_rect = pole_surf.get_rect()
|
|
|
|
pole_surf_rect.x = POLE_POZ[0]
|
|
|
|
pole_surf_rect.y = POLE_POZ[1]
|
|
|
|
|
|
|
|
pole1_surf = pygame.Surface([POLE_SZER+150,POLE_WYS+150])
|
|
|
|
pole1_surf.fill((0,0,0))
|
|
|
|
pole1_surf_rect = pole_surf.get_rect()
|
|
|
|
pole1_surf_rect.x = POLE_POZ[0] - 75
|
|
|
|
pole1_surf_rect.y = POLE_POZ[1] - 75
|
|
|
|
#Tworzenie pól pola(w sensie właściwe pola do obróbki)
|
|
|
|
|
|
|
|
|
|
|
|
#Zezwalamy na przechwytywanie klawiszy
|
|
|
|
pygame.event.pump()
|
|
|
|
|
|
|
|
##########################################
|
|
|
|
#główna pętla
|
|
|
|
while True:
|
|
|
|
for event in pygame.event.get():
|
|
|
|
#zamknięcie okna
|
|
|
|
# print(event)
|
|
|
|
if event.type == QUIT:
|
|
|
|
quit()
|
|
|
|
elif event.type == KEYDOWN:
|
|
|
|
TRAKTOR_POZ_POLA = [int(((TRAKTOR_POZ[1]-5)/70)-1), int(((TRAKTOR_POZ[0]-5)/70)-1)]
|
|
|
|
if functions.pressed(pygame.key.get_pressed(),TRAKTOR_POZ_POLA) == 1:
|
|
|
|
ILE_RUCHOW+=1
|
|
|
|
#kolor okna
|
|
|
|
okno.fill(COL)
|
|
|
|
#wstawienie pola
|
|
|
|
okno.blit(pole1_surf,pole1_surf_rect)
|
|
|
|
okno.blit(pole_surf,pole_surf_rect)
|
|
|
|
text_value = "Ile ruchów: " + str(ILE_RUCHOW) + " Tryb: " + activity.modes[activity.activity_get_value()]
|
|
|
|
font = pygame.font.Font('freesansbold.ttf', 24)
|
|
|
|
text = font.render(text_value, True, (0, 0, 0), COL)
|
|
|
|
okno.blit(text, text_rect)
|
|
|
|
|
|
|
|
# pole_surf.blit(images[4], (0,0))
|
|
|
|
for i in range(0,700,70):
|
|
|
|
for j in range(0,700,70):
|
|
|
|
pole_surf.blit(images[POLE_STAN[int(i/70),int(j/70)]],(j,i))
|
2020-04-06 18:47:06 +02:00
|
|
|
traktor_img = pygame.image.load('images/'+traktor.traktor_get())
|
2020-04-06 18:24:02 +02:00
|
|
|
okno.blit(traktor_img, TRAKTOR_POZ)
|
|
|
|
#aktualizacja okna i wyświetlenie
|
|
|
|
pygame.display.update()
|