main.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import pygame, sys
  2. from pygame.locals import * # Import des constantes de pygame
  3. from world import *
  4. from variables import *
  5. def main():
  6. """La fonction pricipale"""
  7. ### Initialmisation ###
  8. pygame.init() # La fonction secrète, on sait pas ce qu'elle fait mais elle doit être là
  9. display = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT)) # Taille de la fenêtre
  10. display.fill(BACKGROUND_COLOR)
  11. pygame.display.set_caption("VISI301") # Nom de la fenêtre, à changer à la fin TODO
  12. create_world(display, NB_COL, NB_ROW, GAP)
  13. ### Boucle principale ###
  14. while True:
  15. # À chaque tick on fait ce qu'il y a là
  16. # create_world(display, NB_COL, NB_ROW, GAP)
  17. for event in pygame.event.get():
  18. # On fait des trucs
  19. # Fermeture du jeu
  20. if event.type == QUIT:
  21. pygame.quit()
  22. sys.exit()
  23. pygame.display.update()
  24. pygame.display.flip()
  25. # On quitte pygame
  26. pygame.quit()
  27. # On lance la fonction principale
  28. main()