Commit bc54c1bd by BellCodeEditor

save project

parent 3bb3fdf3
Showing with 18 additions and 3 deletions
...@@ -15,7 +15,7 @@ logo_img = pygame.image.load('logo.png') # 涓棿logo鍥? ...@@ -15,7 +15,7 @@ logo_img = pygame.image.load('logo.png') # 涓棿logo鍥?
basic_font = pygame.font.Font('neuropol.ttf', 14) # 瀛椾綋 basic_font = pygame.font.Font('neuropol.ttf', 14) # 瀛椾綋
music_list = [] music_list = []
path = "C:\\Users\\bellcode\\Desktop\\test" path = "C:\\Users\\makcoo\\Desktop\\sb"
filelist = os.listdir(path) filelist = os.listdir(path)
for i in filelist: for i in filelist:
if i[-4:] == ".ogg" or i[-4:] == ".wav": if i[-4:] == ".ogg" or i[-4:] == ".wav":
...@@ -29,6 +29,9 @@ play_button = stop_img ...@@ -29,6 +29,9 @@ play_button = stop_img
angle = 0 angle = 0
while True: while True:
m1=pygame.mixer.Sound(path +"\\" +music_list[num])
music_long=m1.get_length()
music_long=int(music_long)
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
exit() exit()
...@@ -72,7 +75,10 @@ while True: ...@@ -72,7 +75,10 @@ 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()
play_button = stop_img play_button = stop_img
click = 0 click = 0
m1=pygame.mixer.Sound(path +"\\" +music_list[num])
music_long=m1.get_length()
music_long=int(music_long)
if pygame.mixer.music.get_busy() == False: # 闊充箰鏄惁姝e湪鎾斁 if pygame.mixer.music.get_busy() == False: # 闊充箰鏄惁姝e湪鎾斁
num += 1 num += 1
...@@ -88,8 +94,14 @@ while True: ...@@ -88,8 +94,14 @@ while True:
play_m = play_time//60 # 鍒? play_m = play_time//60 # 鍒?
play_s = play_time % 60 # 绉? play_s = play_time % 60 # 绉?
if if play_s<10:
play_s="0"+str(play_s)
info = str(play_m) + ":" + str(play_s) info = str(play_m) + ":" + str(play_s)
music_m=music_long//60
music_s=music_long%60
if music_s<10:
music_s="0"+str(music_s)
info2="/"+str(music_m)+":"+str(music_s)
# 鏃嬭浆鍚庣殑鍞辩洏鍥剧墖 # 鏃嬭浆鍚庣殑鍞辩洏鍥剧墖
...@@ -106,7 +118,9 @@ while True: ...@@ -106,7 +118,9 @@ while True:
screen.blit(next_img, (420, 350)) # 涓嬩竴鏇? screen.blit(next_img, (420, 350)) # 涓嬩竴鏇?
# 缁樺埗鏃堕棿杩涘害 # 缁樺埗鏃堕棿杩涘害
scoreSurf = basic_font.render(info, True, (255, 255, 255)) scoreSurf = basic_font.render(info, True, (255, 255, 255))
scoreSurf2 = basic_font.render(info2, True, (0, 0, 0))
screen.blit(scoreSurf, (120,440)) screen.blit(scoreSurf, (120,440))
screen.blit(scoreSurf2,(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