Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Pygame base template for opening a window, done with functions
- """
- import pygame
- # Define some colors as global constants
- BLACK = (0x00, 0x00, 0x00)
- WHITE = (0xff, 0xff, 0xff)
- GREEN = (0x00, 0xff, 0x00)
- RED = (0xff, 0x00, 0x00)
- def main():
- """ Main function for the game. """
- pygame.init()
- # Set the width and height of the screen [width,height]
- size = [800, 600]
- screen = pygame.display.set_mode(size)
- pygame.display.set_caption("My Game")
- running = True
- clock = pygame.time.Clock()
- # -------- Main Program Loop -----------
- while running:
- # Event processing
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- running = False
- # Game logic
- # Code to draw
- screen.fill(WHITE)
- pygame.display.flip()
- clock.tick(60)
- pygame.quit()
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement