Commit e52289fa by BellCodeEditor

save project

parent 4f5f2456
Showing with 17 additions and 2 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') # 下一曲按钮
basic_font=pygame.font.Font('neuropol.ttf',14)
FPS=pygame.time.Clock() FPS=pygame.time.Clock()
music_list = [] music_list = []
path = "C:\\Users\\2\\Desktop\\text" path = "C:\\Users\\2\\Desktop\\text"
...@@ -57,6 +58,8 @@ while True: ...@@ -57,6 +58,8 @@ while True:
num += 1 num += 1
if num > len(music_list) - 1: if num > len(music_list) - 1:
num = 0 num = 0
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
play_button = stop_img play_button = stop_img
...@@ -64,7 +67,7 @@ while True: ...@@ -64,7 +67,7 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 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:
...@@ -77,6 +80,13 @@ while True: ...@@ -77,6 +80,13 @@ while True:
else: else:
click += 1 click += 1
play_time=pygame.mixer.music.get_pos()
play_time=
play_m=play_time//60
play_s=play_time%60
info=str(play_m)+':'+str(play_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:
...@@ -84,16 +94,21 @@ while True: ...@@ -84,16 +94,21 @@ while True:
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
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))
print(newRect)
pos = (newRect[0],newRect[1]) pos = (newRect[0],newRect[1])
if play_button == stop_img: if play_button == stop_img:
angle+=1 angle+=1
# 绘制画面 # 绘制画面
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(scoreSurf,(120,440))
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(logo_img, pos) # 中间logo图 screen.blit(logo_img, pos) # 中间logo图
......
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