Adding in pygame, and getting a window to display/close
This commit is contained in:
22
main.py
Normal file
22
main.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# this allows us to use code from
|
||||
# the open-source pygame library
|
||||
# throughout this file
|
||||
import pygame
|
||||
from constants import *
|
||||
|
||||
def main():
|
||||
pygame.init()
|
||||
print("Starting asteroids!")
|
||||
print(f"Screen width: {SCREEN_WIDTH}")
|
||||
print(f"Screen height: {SCREEN_HEIGHT}")
|
||||
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()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user