Commit 4794b9d1 by BellCodeEditor

save project

parent fdb6805d
Showing with 18 additions and 8 deletions
......@@ -14,7 +14,6 @@ logo_img = pygame.image.load('logo.png') # 下一曲按钮
# 载入音乐
pygame.mixer.music.load('歌曲3.wav') # 载入音乐
volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
......@@ -35,19 +34,32 @@ while True:
volume -= 0.1
if volume < 0:
volume = 0
pygame.mixer.music.set_volume(volume)
if event.type == locals.MOUSEBUTTONDOWN:
click += 1
if event.type == locals.MOUSEBUTTONDOWN:
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:
play_button = stop_img
pygame.mixer.music.unpause()
else:
play_button = play_img
pygame.mixer.music.pause()
if pygame.mixer.music.get_busy() == False:
if x > 270 and x < 370 and and y >350 and y< 450:
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()
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
......@@ -56,4 +68,3 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面
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