Commit 5a1adae1 by BellCodeEditor

save project

parent 0b6cba6c
Showing with 9 additions and 4 deletions
...@@ -4,6 +4,8 @@ import os ...@@ -4,6 +4,8 @@ import os
music_list=[] music_list=[]
pygame.init() # 初始化 pygame.init() # 初始化
angle=0 angle=0
pygame.time.Clock()
FPS=pygame.time.Clock()
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
# 载入图片、资源 # 载入图片、资源
...@@ -45,6 +47,7 @@ while True: ...@@ -45,6 +47,7 @@ while True:
if event.type == locals.MOUSEBUTTONDOWN: if event.type == locals.MOUSEBUTTONDOWN:
if event.button == 1: # 左击 if event.button == 1: # 左击
angle=angle
x, y = event.pos x, y = event.pos
if x > 270 and x < 370 and y > 350 and y < 450: # 播放按钮 if x > 270 and x < 370 and y > 350 and y < 450: # 播放按钮
click += 1 click += 1
...@@ -64,7 +67,7 @@ while True: ...@@ -64,7 +67,7 @@ while True:
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
else: else:
click += 1 click +=2
if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲 if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲
num -= 1 num -= 1
...@@ -87,7 +90,8 @@ while True: ...@@ -87,7 +90,8 @@ while True:
new_logo = pygame.transform.rotate(logo_img, angle) new_logo = pygame.transform.rotate(logo_img, angle)
newRect = new_logo.get_rect(center=(320,200)) newRect = new_logo.get_rect(center=(320,200))
pos = (newRect[0],newRect[1]) pos = (newRect[0],newRect[1])
angle += 1 if play_button == stop_img:
angle += 1
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮 screen.blit(play_button, (270, 330)) # 暂停按钮
...@@ -95,4 +99,5 @@ while True: ...@@ -95,4 +99,5 @@ while True:
screen.blit(last_img, (120, 350)) # 上一曲 screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
\ No newline at end of file FPS.tick(60)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment