forked from bitcraft/polerunner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
41 lines (30 loc) · 895 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from lib2d.game import Game
from lib2d import gfx, context
import pygame
profile = 1
class TestGame(Game):
def start(self):
from lib.titlescreen import TitleScreen
gfx.set_screen((1024, 600), 3, "scale")
self.sd = context.GameDriver(self, 60)
self.sd.reload_screen()
self.sd.append(TitleScreen(self.sd))
self.sd.run()
if __name__ == "__main__":
if profile:
import cProfile
import pstats
import sys
game = TestGame()
try:
cProfile.run('game.start()', "results.prof")
except KeyboardInterrupt:
pass
else:
p = pstats.Stats("results.prof")
p.strip_dirs()
p.sort_stats('time').print_stats(20, "^((?!pygame).)*$")
p.sort_stats('time').print_stats(20)
else:
TestGame().start()
pygame.quit()