MCPcopy
hub / github.com/CharlesPikachu/Games / StartInterface

Function StartInterface

cpgames/core/games/aircraftwar/modules/interfaces.py:29–43  ·  view source on GitHub ↗
(screen, cfg, resource_loader)

Source from the content-addressed store, hash-verified

27
28'''开始界面'''
29def StartInterface(screen, cfg, resource_loader):
30 clock = pygame.time.Clock()
31 while True:
32 button_1 = Button(screen, (330, 190), '单人模式', cfg, resource_loader)
33 button_2 = Button(screen, (330, 305), '双人模式', cfg, resource_loader)
34 for event in pygame.event.get():
35 if event.type == pygame.QUIT:
36 QuitGame()
37 if event.type == pygame.MOUSEBUTTONDOWN:
38 if button_1.collidepoint(pygame.mouse.get_pos()):
39 return 1
40 elif button_2.collidepoint(pygame.mouse.get_pos()):
41 return 2
42 clock.tick(cfg.FPS)
43 pygame.display.update()
44
45
46'''结束界面'''

Callers 1

runMethod · 0.50

Calls 4

QuitGameFunction · 0.85
tickMethod · 0.80
ButtonFunction · 0.70
updateMethod · 0.45

Tested by

no test coverage detected