import sys

import json
from random import random, seed

from pygame.transform import scale
import pygame

from src.controller.window import ControlWindow
from src.projection.screen import Screen, Star


def cli_main():
    seed(43)
    image = pygame.image.load('resources/star.png')

    stars = [
        Star(**{
            "_id": i,
            "x": random(),
            "y": random(),
            "alpha": random() * 360,
            "rot": random() * 360,
            "scale": random() * 0.5 + 0.25,
            "offset": random(),
            "image": image
        })
        for i in range(4)
    ]

    control_window = ControlWindow()
    screen = Screen(stars)

    while control_window.is_running():
        control_window.process_events()
        screen.update()

    screen.close()
    control_window.close()



if __name__ == "__main__":
    cli_main()