Commit 5a63e06b by BellCodeEditor

save project

parent 551a32e6
Showing with 21 additions and 3 deletions
......@@ -26,7 +26,9 @@ volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
music1=pygame.mixer.Sound(path + "\\" + music_list[num])
music_length=music1.get_length()
music_length=int(music_length)
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -66,7 +68,9 @@ while True:
click += 2
else:
click += 1
music1=pygame.mixer.Sound(path + "\\" + music_list[num])
music_length=music1.get_length()
music_length=int(music_length)
if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲
num -= 1
if num < 0:
......@@ -78,7 +82,10 @@ while True:
click += 2
else:
click += 1
music1=pygame.mixer.Sound(path + "\\" + music_list[num])
music_length=music1.get_length()
music_length=int(music_length)
if pygame.mixer.music.get_busy() == False:
num += 1
if num > len(music_list)-1:
......@@ -96,7 +103,15 @@ while True:
play_time=int(play_time/1000)
play_m=play_time//60
play_s=play_time%60
if play_s<10:
play_s="0"+str(play_s)
info=str(play_m)+":"+str(play_s)
music_m=music_length//60
music_s=music_length%60
if music_s<10:
music_s="0"+str(music_s)
info2=str(music_m)+":"+str(music_s)
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
......@@ -105,5 +120,7 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲
scoreSurf=basic_font.render(info,True,(255,255,255))
screen.blit(scoreSurf,(120,440))
scoreSurf2=basic_font.render("/"+info2,True,(0,0,0))
screen.blit(scoreSurf2,(170,440))
# 刷新画面
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