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 | |
---|
1 | import pygame, platform
|
---|
2 |
|
---|
3 | system = platform.system()
|
---|
4 |
|
---|
5 | [w, h] = [0, 0]
|
---|
6 |
|
---|
7 | if system == 'Windows':
|
---|
8 | print("Windows detected")
|
---|
9 |
|
---|
10 | import ctypes
|
---|
11 | user32 = ctypes.windll.user32
|
---|
12 | [w, h] = [user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)]
|
---|
13 | elif system == 'Linux':
|
---|
14 | print("Linux detected")
|
---|
15 | else:
|
---|
16 | print("Unknown OS: " + system)
|
---|
17 |
|
---|
18 | print("Detected native resolution: {:d}x{:d}".format(w, h))
|
---|
19 |
|
---|
20 | pygame.init()
|
---|
21 |
|
---|
22 | if w == 0 and h == 0:
|
---|
23 | print("Not using fullscreen")
|
---|
24 | gameDisplay = pygame.display.set_mode((800, 600))
|
---|
25 | else:
|
---|
26 | gameDisplay = pygame.display.set_mode((w, h), pygame.FULLSCREEN)
|
---|
27 |
|
---|
28 | pygame.display.set_caption('Space Game')
|
---|
29 |
|
---|
30 | clock = pygame.time.Clock()
|
---|
31 |
|
---|
32 | running = True
|
---|
33 |
|
---|
34 | while 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 |
|
---|
47 | pygame.quit()
|
---|
48 | print("Game ended")
|
---|
49 | quit() |
---|
Note:
See
TracBrowser
for help on using the repository browser.