Commit 429f74a8 by BellCodeEditor

auto save

parent c75c4975
Showing with 25 additions and 2 deletions
...@@ -11,6 +11,7 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮 ...@@ -11,6 +11,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') # 下一曲按钮
a=pygame.font.Font("neuropol.ttf",18)
music=[] music=[]
angle=0 angle=0
num=-1 num=-1
...@@ -62,6 +63,9 @@ while True: ...@@ -62,6 +63,9 @@ while True:
pygame.mixer.music.play() pygame.mixer.music.play()
click=0 click=0
play_button = stop_img play_button = stop_img
music1=pygame.mixer.Sound(path+"\\"+music[num])
music1_time=music1.get_length()
music1_time=int(music1_time)
if x>420 and x<520 and y>350 and y<400: if x>420 and x<520 and y>350 and y<400:
num+=1 num+=1
if num>len(music)-1: if num>len(music)-1:
...@@ -70,22 +74,38 @@ while True: ...@@ -70,22 +74,38 @@ while True:
pygame.mixer.music.play() pygame.mixer.music.play()
click=0 click=0
play_button = stop_img play_button = stop_img
music1=pygame.mixer.Sound(path+"\\"+music[num])
music1_time=music1.get_length()
music1_time=int(music1_time)
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num+=1 num+=1
if num>len(music)-1: if num>len(music)-1:
num=0 num=0
pygame.mixer.music.load(path+"\\"+music[num]) pygame.mixer.music.load(path+"\\"+music[num])
pygame.mixer.music.play() pygame.mixer.music.play()
music1=pygame.mixer.Sound(path+"\\"+music[num])
music1_time=music1.get_length()
music1_time=int(music1_time)
time=pygame.mixer.music.get_pos() time=pygame.mixer.music.get_pos()
time=int(time/1000) time=int(time/1000)
play_m=time//60 play_m=time//60
play_s=time%60 play_s=time%60
if play_s<10:
play_s="0"+str(play_s)
info=str(play_m)+":"+str(play_s)
b=a.render(info,True,(0,0,0))
play_m=music1_time//60
play_s=music1_time%60
if play_s<10:
play_s="0"+str(play_s)
info=str(play_m)+":"+str(play_s) info=str(play_m)+":"+str(play_s)
print(info) m=a.render(info,True,(0,0,0))
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 angle+=1
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
...@@ -93,5 +113,7 @@ while True: ...@@ -93,5 +113,7 @@ while True:
screen.blit(new_logo,pos) # 中间logo图 screen.blit(new_logo,pos) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲 screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
screen.blit(b,(120,440))
screen.blit(m,(200,440))
# 刷新画面 # 刷新画面
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