forked from zhiyuan/Project1
去除顶部标题栏,添加菜单场景退出游戏功能
This commit is contained in:
1 parent
9b03f6906e
commit
5ca95505f2
2 files changed
+7
-8
No files matched your search
@@ -18,7 +18,7 @@ class MainMenuScene(BaseScene):
|
||||
self.font = pygame.font.Font(font_file,16)
|
||||
|
||||
# 文本
|
||||
self.game_info_text = self.font.render('按任意键开始游戏', True, Color.white)
|
||||
self.game_info_text = self.font.render('按任意键开始游戏,鼠标点击退出', True, Color.white)
|
||||
|
||||
def update(self):
|
||||
# 按键按下则切换场景
|
||||
@@ -40,8 +40,8 @@ class MainMenuScene(BaseScene):
|
||||
def handle_event(self, event):
|
||||
if event.type == pygame.KEYDOWN:
|
||||
self.button_status = True
|
||||
if event.type == pygame.MOUSEBUTTONDOWN:
|
||||
self.button_status = True
|
||||
elif event.type == pygame.MOUSEBUTTONDOWN:
|
||||
return "exit" # 主循环接收返回,为exit时设置running为False,退出游戏
|
||||
|
||||
def __show(self, info, dest=(0, 0)):
|
||||
if not self.debug_status:
|
||||
|
||||
Reference in new issue
Block a user