-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
35 lines (28 loc) · 838 Bytes
/
main.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
from BattleCity import BattleCity as Game
from menu import Menu
import pygame
from pygame.locals import *
class BattleCity:
def __init__(self):
pygame.init()
pygame.mixer.init()
pygame.display.set_caption('坦克大战')
self.width = 1366
self.height = 768 # 屏幕大小
self.bgSize = (self.width,self.height)
self.screen = pygame.display.set_mode(self.bgSize, FULLSCREEN | HWSURFACE) # 全屏
self.menu = Menu(self.screen)
self.game = Game(self.screen)
def run(self):
config = self.menu.run()
self.game.setConfig(config)
self.game.run()
if __name__ == '__main__':
main = BattleCity()
main.run()
# try:
# main.run()
# except SystemExit:
# pass
# except Exception as e:
# print(e)