Commit 3672d6af by BellCodeEditor

save project

parent 84805bed
Showing with 28 additions and 2 deletions
...@@ -31,6 +31,12 @@ angle=0 ...@@ -31,6 +31,12 @@ angle=0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
play=pygame.mixer.Sound(path+"\\"+music_list[num])
pla_time=play.get_length()
pla_time=int(pla_time)
pla_m = pla_time//60
pla_s = pla_time%60
inf = str(pla_m)+":"+str(pla_s)
exit() exit()
# 按键,控制声音大小 # 按键,控制声音大小
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
...@@ -67,7 +73,13 @@ while True: ...@@ -67,7 +73,13 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
play=pygame.mixer.Sound(path+"\\"+music_list[num])
pla_time=play.get_length()
pla_m = pla_time//60
pla_s = pla_time%60
inf = str(pla_m)+":"+str(pla_s)
if click%2==0:
angle += 1
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
if num < 0: if num < 0:
...@@ -79,7 +91,11 @@ while True: ...@@ -79,7 +91,11 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
play=pygame.mixer.Sound(path+"\\"+music_list[num])
pla_time=play.get_length()
pla_m = pla_time//60
pla_s = pla_time%60
inf = str(pla_m)+":"+str(pla_s)
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num += 1 num += 1
if num > len(music_list)-1: if num > len(music_list)-1:
...@@ -92,10 +108,17 @@ while True: ...@@ -92,10 +108,17 @@ while True:
play_m = play_time//60 play_m = play_time//60
play_s = play_time%60 play_s = play_time%60
info = str(play_m)+":"+str(play_s) info = str(play_m)+":"+str(play_s)
play=pygame.mixer.Sound(path+"\\"+music_list[num])
pla_time=play.get_length()
pla_m = pla_time//60
pla_s = pla_time%60
inf = str(pla_m)+":"+str(pla_s)
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))
if click%2==0: if click%2==0:
angle += 1 angle += 1
print(inf)
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮 screen.blit(play_button, (270, 330)) # 暂停按钮
...@@ -104,5 +127,7 @@ while True: ...@@ -104,5 +127,7 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面 # 刷新画面
scoreSurt = dacis_font.render(info,True,(255,255,255)) scoreSurt = dacis_font.render(info,True,(255,255,255))
m_long = dacis_font.render(inf,True,(255,255,255))
screen.blit(scoreSurt,(120,420)) screen.blit(scoreSurt,(120,420))
screen.blit(m_long,(150,420))
pygame.display.update() pygame.display.update()
\ 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