Commit 175cbf34 by BellCodeEditor

auto save

parent 3bd3b065
Showing with 13 additions and 8 deletions
...@@ -21,12 +21,11 @@ for i in filelist: ...@@ -21,12 +21,11 @@ for i in filelist:
if i[-4:] == ".ogg" or i[-4:] == ".wav": if i[-4:] == ".ogg" or i[-4:] == ".wav":
music_list.append(i) music_list.append(i)
num = -1 num = -1
angle = 0
volume = 0.2 volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量 pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0 click = 0 #初次点击次数
play_button = stop_img play_button = stop_img #按钮初始状态
angle = 0 #旋转角度
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -69,7 +68,7 @@ while True: ...@@ -69,7 +68,7 @@ while True:
num -= 1 num -= 1
if num < 0: if num < 0:
num = len(music_list) - 1 num = len(music_list) - 1
pygame.mixer.music.load(path + music_list[num]) pygame.mixer.music.load(path+"\\"+music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
play_button = stop_img play_button = stop_img
if click % 2 == 0: if click % 2 == 0:
...@@ -81,8 +80,13 @@ while True: ...@@ -81,8 +80,13 @@ while True:
num += 1 num += 1
if num > len(music_list)-1: if num > len(music_list)-1:
num = 0 num = 0
pygame.mixer.music.load(path+music_list[num]) pygame.mixer.music.load(path+"\\"+music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
play_time=pygame.mixer.music.get_pos()
play_time = int(play_time/1000)
play_m = play_time//60
play_s = play_time%60
info = str(play_m)+":"+str(play_s)
# +++++++++++++++++++++++++++++++++++++ # +++++++++++++++++++++++++++++++++++++
# 旋转图片(注意:这里要搞一个新变量,存储旋转后的图片) # 旋转图片(注意:这里要搞一个新变量,存储旋转后的图片)
new_logo = pygame.transform.rotate(logo_img, angle) new_logo = pygame.transform.rotate(logo_img, angle)
...@@ -90,12 +94,13 @@ while True: ...@@ -90,12 +94,13 @@ while True:
newRect = new_logo.get_rect(center=(320, 200)) newRect = new_logo.get_rect(center=(320, 200))
# print(newRect) # rect(170, 65, 300, 270) 左上角坐标、图片大小 # print(newRect) # rect(170, 65, 300, 270) 左上角坐标、图片大小
pos = (newRect[0], newRect[1]) pos = (newRect[0], newRect[1])
angle += 1 if play_button==stop_img:
angle += 1
# +++++++++++++++++++++++++++++++++++++ # +++++++++++++++++++++++++++++++++++++
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮 screen.blit(play_button, (270, 330)) # 暂停按钮
# screen.blit(new_logo, (170, 60)) # 中间logo图 #screen.blit(new_logo, (170, 60)) # 中间logo图
screen.blit(new_logo, pos) # 中间logo图 screen.blit(new_logo, pos) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲 screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
......
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