source: python-game/game.py@ 3960923

Last change on this file since 3960923 was 3960923, checked in by Dmitry Portnoy <dmp1488@…>, 8 years ago

Initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1import pygame, platform
2
3system = platform.system()
4
5[w, h] = [0, 0]
6
7if system == 'Windows':
8 print("Windows detected")
9
10 import ctypes
11 user32 = ctypes.windll.user32
12 [w, h] = [user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)]
13elif system == 'Linux':
14 print("Linux detected")
15else:
16 print("Unknown OS: " + system)
17
18print("Detected native resolution: {:d}x{:d}".format(w, h))
19
20pygame.init()
21
22if w == 0 and h == 0:
23 print("Not using fullscreen")
24 gameDisplay = pygame.display.set_mode((800, 600))
25else:
26 gameDisplay = pygame.display.set_mode((w, h), pygame.FULLSCREEN)
27
28pygame.display.set_caption('Space Game')
29
30clock = pygame.time.Clock()
31
32running = True
33
34while running:
35 for event in pygame.event.get():
36 if event.type == pygame.QUIT:
37 running = False
38 elif event.type == pygame.KEYDOWN:
39 if event.key == pygame.K_ESCAPE:
40 running = False
41
42 #print(event)
43
44 pygame.display.update()
45 clock.tick(60)
46
47pygame.quit()
48print("Game ended")
49quit()
Note: See TracBrowser for help on using the repository browser.