Commit eb1c69b9 by BellCodeEditor

save project

parent 837aeaff
Showing with 18 additions and 5 deletions
...@@ -13,7 +13,7 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮 ...@@ -13,7 +13,7 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img = pygame.image.load('last.png') # 上一曲按钮 last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮 next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮 logo_img = pygame.image.load('logo.png') # 下一曲按钮
basic_font=pygame.font.Font(neuropol.ttf) basic_font=pygame.font.Font("neuropol.ttf",14)
angle=0 angle=0
music_list = [] music_list = []
...@@ -67,13 +67,20 @@ while True: ...@@ -67,13 +67,20 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
#
if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲 music1=pygame.mixer.Sound(path+"//"+music_list[num])
num -= 1 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: if num < 0:
num = len(music_list) - 1 num = len(music_list) - 1
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
music1=pygame.mixer.Sound(path+"//"+music_list[num])
music_length=music1.get_length()
music_length=int(music_length)
play_button = stop_img play_button = stop_img
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
...@@ -95,6 +102,9 @@ while True: ...@@ -95,6 +102,9 @@ 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)
music_m=music_length//60
music_s=music_length%60
info2=str(music_m)+str(music_s)
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮 screen.blit(play_button, (270, 330)) # 暂停按钮
...@@ -103,6 +113,9 @@ while True: ...@@ -103,6 +113,9 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
scoreSurf=basic_font.render(info,True,(255,255,255)) scoreSurf=basic_font.render(info,True,(255,255,255))
screen.blit(scoreSurf,(120,440)) screen.blit(scoreSurf,(120,440))
scoreSurf2=basic_font.render("/"+info2,True,(0,0,0))
screen.blit(scoreSurf,(120,440))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(60) FPS.tick(60)
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