Commit 405aa875 by BellCodeEditor

auto save

parent e5435a3f
Showing with 17 additions and 0 deletions
...@@ -39,13 +39,16 @@ while True: ...@@ -39,13 +39,16 @@ while True:
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.key == locals.K_w: if event.key == locals.K_w:
volume += 0.1 volume += 0.1
if volume > 1: if volume > 1:
volume = 1 volume = 1
vl=10*volume
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
if event.key == locals.K_s: if event.key == locals.K_s:
volume -= 0.1 volume -= 0.1
if volume < 0: if volume < 0:
volume = 0 volume = 0
vl=10*volume
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
if event.type == locals.MOUSEBUTTONDOWN: if event.type == locals.MOUSEBUTTONDOWN:
if event.button == 1: # 左击 if event.button == 1: # 左击
...@@ -69,6 +72,12 @@ while True: ...@@ -69,6 +72,12 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
music1=pygame.mixer.Sound(path + "\\" + music_list[num])
music_length=music1.get_length()
music_length=int(music_length)
music_s=music_length%60
music_m=music_length//60
music_info="/"+str(music_m)+":"+str(music_s)
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:
...@@ -80,6 +89,12 @@ while True: ...@@ -80,6 +89,12 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
music1=pygame.mixer.Sound(path + "\\" + music_list[num])
music_length=music1.get_length()
music_length=int(music_length)
music_s=music_length%60
music_m=music_length//60
music_info="/"+str(music_m)+":"+str(music_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:
...@@ -113,6 +128,8 @@ while True: ...@@ -113,6 +128,8 @@ while True:
screen.blit(scoreSurf,(120,440)) screen.blit(scoreSurf,(120,440))
scoreSurf2=basic_font.render("/"+music_info,True,(0,0,0)) scoreSurf2=basic_font.render("/"+music_info,True,(0,0,0))
screen.blit(scoreSurf2,(160,440)) screen.blit(scoreSurf2,(160,440))
v=basic_font.render(vl,True,(0,0,0))
screen.blit(v_img,(200,440))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
......
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