Commit 405fe928 by BellCodeEditor

save project

parent 8cae1dd2
Showing with 18 additions and 5 deletions
...@@ -68,6 +68,9 @@ while True: ...@@ -68,6 +68,9 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
music1 = pygame.mixer.Sound(path + "\\" + music_list[num])
music_len = int(music1.get_length())
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
...@@ -80,14 +83,16 @@ while True: ...@@ -80,14 +83,16 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
music1 = pygame.mixer.Sound(path + "\\" + music_list[num])
music_len = int(music1.get_length())
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
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_len = int(music1.get_length())
new_img = pygame.transform.rotate(logo_img,jiaodu) new_img = pygame.transform.rotate(logo_img,jiaodu)
zuobiao = new_img.get_rect(center=(320,200)) zuobiao = new_img.get_rect(center=(320,200))
x,y = zuobiao[:2] x,y = zuobiao[:2]
...@@ -97,10 +102,16 @@ while True: ...@@ -97,10 +102,16 @@ while True:
miao = int(haomiao/1000) miao = int(haomiao/1000)
miao_ = miao % 60 miao_ = miao % 60
fen_ = miao // 60 fen_ = miao // 60
if miao_<10:
miao_ = '0'+str(miao_)
zong_fen = music_len//60
zong_miao = music_len%60
if zong_miao<10:
zong_miao = '0'+str(zong_miao)
info = str(fen_)+':'+str(miao_) info = str(fen_)+':'+str(miao_)
new_wenzi = wenzi.render(info,True,(0,0,0)) info1 = '/'+str(zong_fen)+':'+str(zong_miao)
new_wenzi = wenzi.render(info,True,(255,255,255))
wenzi2 = wenzi.render(info1,True,(0,0,0))
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
...@@ -109,6 +120,7 @@ while True: ...@@ -109,6 +120,7 @@ while True:
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(new_wenzi,(100,450)) screen.blit(new_wenzi,(100,450))
screen.blit(wenzi2,(150,450))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(60) FPSCLOCK.tick(60)
\ 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