Commit 26908fca by BellCodeEditor

save project

parent 9711b00e
Showing with 19 additions and 2 deletions
...@@ -56,6 +56,9 @@ while True: ...@@ -56,6 +56,9 @@ while True:
num = 0 num = 0
pygame.mixer.music.load(music_list[num]) pygame.mixer.music.load(music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
musicl = pygame.mixer.Sound(music_list[num])
music_length = musicl.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
...@@ -68,6 +71,9 @@ while True: ...@@ -68,6 +71,9 @@ while True:
num = len(music_list) - 1 num = len(music_list) - 1
pygame.mixer.music.load(music_list[num]) pygame.mixer.music.load(music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
musicl = pygame.mixer.Sound(music_list[num])
music_length = musicl.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
...@@ -82,22 +88,32 @@ while True: ...@@ -82,22 +88,32 @@ while True:
num = 0 num = 0
pygame.mixer.music.load(music_list[num]) pygame.mixer.music.load(music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
musicl = pygame.mixer.Sound(music_list[num])
music_length = musicl.get_length()
music_length = int(music_length)
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: if play_button == stop_img:
angle += 1 angle += 1
time=pygame.mixer.music.get_pos() time=pygame.mixer.music.get_pos()
mtime=time//1000//60 mtime=time//1000//60
stime=time//1000%60 stime=time//1000%60
mmusic_length=music_length//60
smusic_length=music_length%60
# 绘制画面 # 绘制画面
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)) # 下一曲
score=myfont.render(str(mtime)+":"+str(stime),True,(0,0,0)) score=myfont.render(str(mtime)+":"+str(stime)+"/"+str(mmusic_length)+":"+str(smusic_length),True,(0,0,0))
screen.blit(score,(120,300)) screen.blit(score,(120,300))
# 刷新画面 # 刷新画面
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