206530219 #1

Merged
xd merged 5 commits from 206530219 into master 2021-06-24 02:15:53 +00:00
1 changed files with 16 additions and 0 deletions
Showing only changes of commit 2c3f2ad90e - Show all commits

16
button.py Normal file
View File

@ -0,0 +1,16 @@
import pygame.font
class play_Button():
def __init__(self, ai_settings, screen, msg):
"""初始化按钮的属性"""
self.screen = screen
self.screen_rect = screen.get_rect()
# 设置按钮的尺寸和其他属性
self.width, self.height = 200, 50 # 按钮的尺寸
self.button_color = (0, 0, 0) # 按钮颜色
self.text_color = (255, 255, 255) # 按钮中文本的颜色
self.font = pygame.font.SysFont(None, 48)
# 创建按钮的rect对象
self.rect = pygame.Rect(540, 300, self.width, self.height)
# self.rect.center = self.screen_rect.center
# 按钮的标签只需创建一次
self.prep_msg(msg)