From b581f4def242e1bcdc0771e917534e693086bc31 Mon Sep 17 00:00:00 2001 From: zhiyuan <2672347597@qq.com> Date: Fri, 7 Aug 2026 22:06:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E8=B0=83=E6=95=B4=E7=BB=93?= =?UTF-8?q?=E6=9E=84=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=90=84=E9=A1=B9=E7=B1=BB?= =?UTF-8?q?=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/colorconf.py | 13 +++++++++++++ common/pageconf.py | 25 +++++++++++++++++++++++++ page/page.py | 8 +++++--- 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 common/colorconf.py create mode 100644 common/pageconf.py diff --git a/common/colorconf.py b/common/colorconf.py new file mode 100644 index 0000000..c7d3aaf --- /dev/null +++ b/common/colorconf.py @@ -0,0 +1,13 @@ +# -*-coding:utf-8 -*- # +# --------------------------------------------------------------------------- +# ProjectName: Game_project +# FileName: colorconf.py +# Author: Zhi_yuan +# Datetime: 2026/8/7 下午9:21 +# Description: +# --------------------------------------------------------------------------- +class Color: + def __init__(self): + self.white = (255, 255, 255) + self.red = (255, 0, 0) + self.blue = (0, 0, 255) \ No newline at end of file diff --git a/common/pageconf.py b/common/pageconf.py new file mode 100644 index 0000000..c77cb26 --- /dev/null +++ b/common/pageconf.py @@ -0,0 +1,25 @@ +# -*-coding:utf-8 -*- # +# --------------------------------------------------------------------------- +# ProjectName: Game_project +# FileName: pageconf.py +# Author: Zhi_yuan +# Datetime: 2026/8/7 下午9:34 +# Description: +# --------------------------------------------------------------------------- +import pygame + + +class Page: + def __init__(self): + # pygame初始化 + pygame.init() + # 音乐模块初始化 + pygame.mixer.init() + # 大小设置 + size = (800, 600) + screen = pygame.display.set_mode(size) + pygame.display.set_caption("New_game") + + +if __name__ == "__main__": + Page() diff --git a/page/page.py b/page/page.py index 2087f5c..54bb407 100644 --- a/page/page.py +++ b/page/page.py @@ -7,6 +7,7 @@ # Description: # --------------------------------------------------------------------------- import pygame +from common.colorconf import Color # 初始化pygame pygame.init() @@ -35,9 +36,10 @@ up_status = False down_status = False # 颜色 -WHITE = (255, 255, 255) -RED = (255, 0, 0) -BLUE = (0, 0, 255) +color = Color() +WHITE = color.white +RED = color.red +BLUE = color.blue # 游戏循环 running = True while running: