Commit 4794b9d1 by BellCodeEditor

save project

parent fdb6805d
Showing with 17 additions and 7 deletions
...@@ -14,7 +14,6 @@ logo_img = pygame.image.load('logo.png') # 下一曲按钮 ...@@ -14,7 +14,6 @@ logo_img = pygame.image.load('logo.png') # 下一曲按钮
# 载入音乐 # 载入音乐
pygame.mixer.music.load('歌曲3.wav') # 载入音乐 pygame.mixer.music.load('歌曲3.wav') # 载入音乐
volume = 0.2 volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量 pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0 click = 0
...@@ -35,17 +34,30 @@ while True: ...@@ -35,17 +34,30 @@ while True:
volume -= 0.1 volume -= 0.1
if volume < 0: if volume < 0:
volume = 0 volume = 0
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
if event.type == locals.MOUSEBUTTONDOWN: if event.type == locals.MOUSEBUTTONDOWN:
click += 1 if event.button==1:
x,y=event.pos
if x > 270 and x < 370 and and y >350 and y< 450:
click+=1
if click % 2 == 0: if click % 2 == 0:
play_button = stop_img play_button = stop_img
pygame.mixer.music.unpause() pygame.mixer.music.unpause()
else: else:
play_button = play_img play_button = play_img
pygame.mixer.music.pause() pygame.mixer.music.pause()
if x > 270 and x < 370 and and y >350 and y< 450:
if pygame.mixer.music.get_busy() == False: num-=1
if num< 0:
num=len(music_list)-1
pygame.mixer.music.losd(path+"\\"+music_list[num])
pygame.mixer.music.play()
if pygame.mixer.music.get_busy()==False:
num+=1
if num>len(music_list)-1:
num=0
pygame.mixer.music.losd(music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
# 绘制画面 # 绘制画面
...@@ -56,4 +68,3 @@ while True: ...@@ -56,4 +68,3 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
s
\ 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