import pygame import sys class Settings: def __init__(self): self.bg_color = (0, 0, 0) # 背景颜色 self.width = 400 self.height = 400 self.cell_size = 25 # 格子大小 self.cell_w = int(self.width / self.cell_size) # 一行的格子数 self.cell_h = int(self.height / self.cell_size) # 一列的格子数 self.num = self.cell_w * self.cell_h self.game_mode = 0 # 游戏状态 self.score = 0 # 游戏得分 self.clock_frq = 3 # 刷新频率 self.my_clock = pygame.time.Clock() if sys.platform.startswith("linux"): self.font_name = pygame.font.match_font('wenquanyizenhei') else: self.font_name = pygame.font.match_font('simhei')