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

Function Button

cpgames/core/games/aircraftwar/modules/interfaces.py:14–25  ·  view source on GitHub ↗
(screen, position, text, cfg, resource_loader)

Source from the content-addressed store, hash-verified

12
13'''定义按钮'''
14def Button(screen, position, text, cfg, resource_loader):
15 bwidth = 310
16 bheight = 65
17 left, top = position
18 pygame.draw.line(screen, (150, 150, 150), (left, top), (left+bwidth, top), 5)
19 pygame.draw.line(screen, (150, 150, 150), (left, top - 2), (left, top + bheight), 5)
20 pygame.draw.line(screen, (50, 50, 50), (left, top + bheight), (left + bwidth, top + bheight), 5)
21 pygame.draw.line(screen, (50, 50, 50), (left + bwidth, top + bheight), (left + bwidth, top), 5)
22 pygame.draw.rect(screen, (100, 100, 100), (left, top, bwidth, bheight))
23 font = resource_loader.fonts['default_l']
24 text_render = font.render(text, 1, (255, 0, 0))
25 return screen.blit(text_render, (left + 50, top + 10))
26
27
28'''开始界面'''

Callers 2

StartInterfaceFunction · 0.70
EndInterfaceFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected