Commit 9a47a7ff by BellCodeEditor

auto save

parent a2e4a7ac
Showing with 20 additions and 10 deletions
......@@ -11,16 +11,18 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
pygame.mixer.music.load("歌曲3.wav")
music=["歌曲1.wav","歌曲2.wav","歌曲3.wav","歌曲4.ogg"]
num=-1
volume=0.2
pygame.mixer.music.set_volume(volume)
button=play_img
button=stop_img
click=0
while True:
for event in pygame.event.get():
if event.type==locals.QUIT:
exit()
if event.type==locals.KEY:
if event.type==locals.KEYDOWN:
if event.key==locals.K_w:
volume+=0.1
if volume>1:
......@@ -31,15 +33,23 @@ while True:
if volume<0:
volume=0
pygame.mixer.music.set_volume(volume)
if event.type==locals.MOUSEBUTTONDOWN:
click+=1
if click%2==0:
pygame.mixer.music.unpause()
button=play_img
else:
pygame.mixer.music.pause()
button=stop_img
if event.button==1:
x,y=event.pos
if x>270 and x<370 and y>350 and y<450:
click+=1
if click%2==0:
pygame.mixer.music.unpause()
button=stop_img
else:
pygame.mixer.music.pause()
button=play_img
if pygame.mixer.music.get_busy() == False:
num+=1
if num>len(music)-1:
num=0
pygame.mixer.music.load(music[num])
pygame.mixer.music.play()
......
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