Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3.4
- # PYGAME 1.x ONLY
- # Setup Python ----------------------------------------------- #
- import pygame, sys
- # Setup pygame/window ---------------------------------------- #
- mainClock = pygame.time.Clock()
- from pygame.locals import *
- pygame.init()
- pygame.display.set_caption('game base')
- monitor_size = [pygame.display.Info().current_w, pygame.display.Info().current_h]
- screen = pygame.display.set_mode((500, 500), pygame.RESIZABLE)
- fullscreen = False
- while True:
- screen.fill((0, 0, 50))
- pygame.draw.rect(screen, (255, 0, 0), pygame.Rect(screen.get_width() - 5 - (screen.get_width() / 5), 50, screen.get_width() / 5, 50))
- for event in pygame.event.get():
- if event.type == QUIT:
- pygame.quit()
- sys.exit()
- if event.type == VIDEORESIZE:
- if not fullscreen:
- screen = pygame.display.set_mode((event.w, event.h), pygame.RESIZABLE)
- if event.type == KEYDOWN:
- if event.key == K_ESCAPE:
- pygame.quit()
- sys.exit()
- if event.key == K_f:
- fullscreen = not fullscreen
- if fullscreen:
- screen = pygame.display.set_mode(monitor_size, pygame.FULLSCREEN)
- else:
- screen = pygame.display.set_mode((screen.get_width(), screen.get_height()), pygame.RESIZABLE)
- pygame.display.update()
- mainClock.tick(60)
Advertisement
Add Comment
Please, Sign In to add comment