#imports the pygame library, and sys library.
import pygame, sys
#import all your key names
from pygame.locals import *

def main():
    #initialize the library and start a clock, just in case we want it.
    pygame.init()
    
    #initialize the clock that will determine how often we render a frame
    clock = pygame.time.Clock()

    #create our canvas that will be draw on.
    resolution = (640, 480)
    canvas = pygame.display.set_mode(resolution)
    pygame.display.set_caption('RENAME ME SO I KNOW WHAT GAME I AM')

    #Pick our background and other colors with R,G,B values between 0 and 255
    backgroundColor = pygame.Color(0,0,0)
    

    #initialize all the default values of variables we want to use
    keysPressed = []
    theShip = Ship()
    theAsteroids = []
    mouseMovedX = 0
    mouseMovedY = 0
    
    #for ever and ever, keep rendering a new frame of our game.
    #this is where code that needs to be run every single frame belongs
    while True:
        #get all of our input events that have happened since the last frame
        for event in pygame.event.get():

            #deal with key presses
            if event.type == KEYDOWN:
                keysPressed.append(event.key)
                if event.key == K_ESCAPE:
                    pygame.quit()
                    return
                
            
            #deal with key releases
            elif event.type == KEYUP:
                keysPressed.remove(event.key)
                    
            #deal with mouse movement
            elif event.type == MOUSEMOTION:
                #the mouse has been moved
                mouseMovedX, mouseMovedY = event.pos
                
            #deal with mousebutton
            elif event.type == MOUSEBUTTONDOWN:
                mousePressedX, mousePressedY = event.pos
                if event.button in (1, 2, 3):
                    #left middle or right mouse click
                    pass
      
        
        
        #determine if a ship-asteroid collision happened

        #determine if a bullet-asteroid collision happened
            
        #adjust the ship velocity

        #move the asteroids, players, and bullets
        
            
            
            
        #Done dealing with events, lets draw updated things on our canvas
        #fill our canvas with a background color, effectively erasing the last frame
        canvas.fill(backgroundColor)
            
        #draw our asteroids
            
        #draw our ship
            
        #draw our crosshair
            
        #draw our bullets
            
        #done drawing all the stuff on our canvas, now lets show it to the user
        pygame.display.update()

        #wait the amount of time which
        clock.tick(30)
        
        

class Asteroid:
    def __init__(self, spd, size):
        self.speed = spd
        self.size = size #radius pretty much
        self.color = pygame.Color(4,255,255)
        self.x = -50
        self.y = -50
        self.dx = randint(-5,5)
        self.dy = randint(-5,5)
        
    def draw(self, canvas):
        pygame.draw.circle(canvas, self.color, (self.x, self.y), self.size)
        
    def move(self):
        self.x = self.x + self.dx
        self.y = self.y + self.dy
        if (self.y >  480 + self.size):
            self.y = - self.size*2
        elif (self.y < -self.size*2):
            self.y = 480 + self.size
        if (self.x > 640 + self.size):
            self.x = -self.size*2
        elif (self.x < -self.size*2):
            self.x = 640 +self.size

class Ship:
    def __init__(self):
        self.direction = 0
        self.color = pygame.Color(255,255,255)
        self.x = 320
        self.y = 240
        self.dx = 0
        self.dy = 0
        self.size = 10
        
    def draw(self, canvas):
        pygame.draw.circle(canvas, self.color, (self.x, self.y),self.size)
    
    def move(self):
        self.x = self.x + self.dx
        self.y = self.y + self.dy
        if (self.y >  480 + self.size):
            self.y = - self.size*2
        elif (self.y < -self.size*2):
            self.y = 480 + self.size
        if (self.x > 640 + self.size):
            self.x = -self.size*2
        elif (self.x < -self.size*2):
            self.x = 640 + self.size

main()
