-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
61 lines (48 loc) · 1.17 KB
/
main.py
File metadata and controls
61 lines (48 loc) · 1.17 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# -*- coding: utf-8 -*-
import os
import sys
import threading
sys.path.append(os.path.dirname(__file__))
from role import *
import DEBUG
pygame.init()
running: bool = True
running_main: bool = True
screen: Surface = pygame.display.set_mode(REAL_SIZE, RESIZABLE)
pygame.display.set_caption(GAME_TURTLE)
jie: Jie = Jie(screen)
if DEBUG_Enable:
frame2.object = jie
def exit_game() -> None:
if running_main and DEBUG_Enable:
frame.Close(True)
frame2.Close(True)
if not DEBUG_Enable:
pygame.quit()
logger.info("end")
sys.exit()
@try_except(exit_game)
def start_game() -> None:
global running, running_main
logger.info("start")
if ICON is not None:
pygame.display.set_icon(ICON)
while running and running_main:
running = jie.update()
@try_except()
def start():
global running_main
if DEBUG_Enable:
a = threading.Thread(target=start_game)
a.start()
DEBUG.start_wx_mainloop(root)
running_main = False
pygame.quit()
logger.info("end")
os.waitstatus_to_exitcode(0)
else:
start_game()
def main():
pass
if __name__ == '__main__':
main()