1
0

main.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. # Création du monde
  13. world = World(display, NB_COL, NB_ROW, GAP)
  14. world.draw()
  15. ### Boucle principale ###
  16. while True:
  17. # À chaque tick on fait ce qu'il y a là
  18. # create_world(display, NB_COL, NB_ROW, GAP)
  19. for event in pygame.event.get():
  20. # On fait des trucs
  21. # Fermeture du jeu
  22. if event.type == QUIT:
  23. pygame.quit()
  24. sys.exit()
  25. pygame.display.update()
  26. # On quitte pygame
  27. pygame.quit()
  28. # On lance la fonction principale
  29. main()