import sys
import pygame
from pygame import QUIT

from Config.InitConfig import InitConfig

# Uncomment the line bellow this to try the Introduction -> Walker behaviors
# from Introduction.Walker import Walker

# Uncomment the line bellow this to try the Introduction -> Perlin Noise Image Generation
# from Introduction.NoiseImage import NoiseImage

# Uncomment the line bellow this to try the Vectors -> Bouncing Ball
from Vectors.BouncingBall import BouncingBall


class MainLoop:

    def __init__(self):
        self.initConfig = InitConfig()

        # Uncomment the line bellow this to try the Introduction -> Walker behaviors
        # self.w = Walker(395, 395, 25, 25, (255, 0, 0))

        # Uncomment the line bellow this to try the Introduction -> Perlin Noise Image Generation
        # self.noiseImage = NoiseImage(self.initConfig.screen)

        # Uncomment the line bellow this to try the Vectors -> Bouncing Ball
        self.b = BouncingBall([200, 100], 25, (255, 0, 0), [2, 5], self.initConfig.screen.get_size())

    def update(self):
        # Uncomment the line bellow this to try the Introduction -> Walker behaviors
        # self.w.update()

        # Uncomment the line bellow this to try the Vectors -> Bouncing Ball
        self.b.update()

    def events(self):
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()

    def draw(self):
        # Uncomment the line bellow this to try the Introduction -> Walker behaviors
        # self.w.draw(self.initConfig.screen)

        # Uncomment the line bellow this to try the Vectors -> Bouncing Ball
        self.initConfig.screen.fill((255, 255, 255))
        self.b.draw(self.initConfig.screen)

        pygame.display.update()
        self.initConfig.clock.tick(60)
