31 lines
633 B
Python
31 lines
633 B
Python
|
|
import pygame
|
||
|
|
import sys
|
||
|
|
|
||
|
|
from constants import *
|
||
|
|
|
||
|
|
def main():
|
||
|
|
print("Starting Asteroids!")
|
||
|
|
print(f"Screen width: {SCREEN_WIDTH}")
|
||
|
|
print(f"Screen height: {SCREEN_HEIGHT}")
|
||
|
|
|
||
|
|
pygame.init()
|
||
|
|
|
||
|
|
if pygame.get_init() == False:
|
||
|
|
pygame.quit()
|
||
|
|
sys.exit(1)
|
||
|
|
|
||
|
|
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
|
||
|
|
|
||
|
|
|
||
|
|
while True:
|
||
|
|
for event in pygame.event.get():
|
||
|
|
if event.type == pygame.QUIT:
|
||
|
|
return
|
||
|
|
|
||
|
|
pygame.Surface.fill(screen, (0,0,0))
|
||
|
|
|
||
|
|
pygame.display.flip() #this is the last in loop | refresh screen
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
main()
|