Commit c71ff7b1 by BellCodeEditor

auto save

parent d7a0fb89
Showing with 7 additions and 16 deletions
......@@ -11,26 +11,21 @@ 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') # 下一曲按钮
list=["frog.mp3","歌曲1.wav"]
i=-1
# 载入音乐
volume = 0.2
# 载入音乐
list=["frog.mp3","歌曲1.wav"]
i=0
volume = 0.5
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
while True:
for event in pygame.event.get():
print(event)
if event.type == locals.QUIT:
exit()
# 按键,控制声音大小
if event.type == locals.KEYDOWN:
if event.key == locals.K_UP:
volume += 0.1
if volume > 1:
......@@ -41,7 +36,6 @@ while True:
if volume < 0:
volume = 0
pygame.mixer.music.set_volume(volume)
# 按下鼠标
if event.type == locals.MOUSEBUTTONUP and event.button == 1:
......@@ -56,16 +50,13 @@ while True:
else:
play_button = play_img
pygame.mixer.music.pause()
if pygame.mixer.music.get_busy() == False:
i+=1
if i > len(list)-1:
# 载入音乐
if i>len(list)-1:
i=0
#pygame.mixer.music.load(list[i])
pygame.mixer.music.load(list[i])
pygame.mixer.music.play()
i+=1
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
......
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