forked from zhiyuan/Project1
创建设置、颜色、场景文件,场景更新逻辑放到单独文件中
This commit is contained in:
1 parent
2f7261f59c
commit
9c8bb2162f
5 files changed
+29
-6
No files matched your search
@@ -1,9 +1,8 @@
|
||||
import pygame
|
||||
|
||||
from src.config.color import Color
|
||||
from src.config.game_config import GameConfig
|
||||
from src.scenes.main_menu_scene import MainMenuScene
|
||||
|
||||
rect = [10,20,30,40]
|
||||
|
||||
class Game:
|
||||
def __init__(self):
|
||||
@@ -29,15 +28,14 @@ class Game:
|
||||
if event.type == pygame.QUIT:
|
||||
self.running = False
|
||||
|
||||
# 清屏
|
||||
self.screen.fill(GameConfig.bg_color)
|
||||
|
||||
self.update()
|
||||
# 场景每帧更新逻辑运行
|
||||
MainMenuScene(self.screen)
|
||||
|
||||
# 更新显示
|
||||
pygame.display.update()
|
||||
|
||||
def update(self):
|
||||
pygame.draw.rect(self.screen, Color.white, rect)
|
||||
|
||||
if __name__ == "__main__":
|
||||
Game()
|
||||
Reference in new issue
Block a user