Commit 89516fe3 by BellCodeEditor

auto save

parent 5a20a42d
Showing with 12 additions and 1 deletions
...@@ -12,6 +12,7 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮 ...@@ -12,6 +12,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') # 下一曲按钮
my_font=pygame.font.Font('neuropol.ttf',18)#载入字体素材
music_list = [] music_list = []
path = r"C:\Users\10839\Desktop\TEST" path = r"C:\Users\10839\Desktop\TEST"
...@@ -78,7 +79,7 @@ while True: ...@@ -78,7 +79,7 @@ while True:
else: else:
click += 1 click += 1
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:
num = 0 num = 0
...@@ -88,12 +89,21 @@ while True: ...@@ -88,12 +89,21 @@ 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])
if play_button==stop_img:
angle+=1 angle+=1
#播放歌曲进度时长
play_time=pygame.mixer.music.get_pos() #单位是毫秒
play_time=int(play_time/1000) #毫秒转化成秒
play_m=play_time//60 #分
play_s=play_time%60 #秒
info=str(play_m)+':'+str(play_s)
text=my_font.render(info,True,(0,0,0)) #渲染文字信息(内容,是否抗锯齿,RGB色号)
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮 screen.blit(play_button, (270, 330)) # 暂停按钮
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(text,(120,410)) #播放进度时间
# 刷新画面 # 刷新画面
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