'''

Funkcja otrzymuje oczekiwane proporcje ekranu (np. 16:9, 4:3) oraz piksele_szerokosc.
Zadaniem funkcji jest obliczyć ile pikseli powinna mieć wysokość, aby proporcje ekranu
były poprawne. Zwracana liczba powinna być liczbą całkowitą

16:9 -> 1920 x 1080
16:9 -> 1280 x 720
4:3 -> 1920 x 1440

Podpowiedź:
piksele szerokości należy podzielić przez proporcję szerokości, a następnie pomnożyć z
proporcjami wysokości.

'''

def oblicz_wysokosc(proporcje_szerokosc, proporcje_wysokosc, piksele_szerokosc):
    return int(piksele_szerokosc / proporcje_szerokosc * proporcje_wysokosc)

print(oblicz_wysokosc(10, 4, 1200))

def przyklad(x, y):
    print(f"{x}, {y}")

przyklad(1, 2)

def przyklad(x):
    print(f"{x}")

przyklad(5)

import pygame
pygame.init()

SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600

screen_surface = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))

pygame.display.set_caption("Pierwsza gra")

clock = pygame.time.Clock()

game_running = True

def load_image(img_path: str, position):
    # image - obraz
    image = pygame.image.load(img_path)
    image = pygame.transform.scale(image, (30, 30))
    surface = image.convert()
    # surface - powierzchnia
    transparent_color = (0, 0, 0)
    surface.set_colorkey(transparent_color)
    # rectangle - wymiar
    rect = surface.get_rect(center=position)

    return [image, surface, rect]

player_pos = [SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2]
player = load_image("h.png", player_pos)

def print_image(img_list) -> None:
    image, surface, rect = img_list
    screen_surface.blit(surface, rect)

while game_running:
    events = pygame.event.get()

    for event in events:
        print(event)

        if event.type == pygame.QUIT:
            game_running = False

    print_image(player)
    pygame.display.update()
    clock.tick(60)

pygame.quit()
quit()
