Commit d29e7c7c by BellCodeEditor

save project

parent 5f0b9c0d
Showing with 24 additions and 5 deletions
......@@ -16,16 +16,21 @@ text=pygame.font.Font("neuropol.ttf",30)
music_list = ["歌曲1.wav","歌曲2.wav","歌曲3.wav","歌曲4.ogg",]
angle=0
num = -1
volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
pygame.mixer.music.load(music_list[num])
pygame.mixer.music.play()
play_button=stop_img
click=0
music1=pygame.mixer.Sound(music_list[num])
music_length=music1.get_length()
music_length=int(music_length)
print(music_length)
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -65,6 +70,9 @@ while True:
click += 2
else:
click += 1
music1=pygame.mixer.Sound(music_list[num])
music_length=music1.get_length()
music_length=int(music_length)
if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲
num -= 1
......@@ -77,13 +85,19 @@ while True:
click += 2
else:
click += 1
music1=pygame.mixer.Sound(music_list[num])
music_length=music1.get_length()
music_length=int(music_length)
if pygame.mixer.music.get_busy() == False:
num += 1
if num > len(music_list)-1:
num = 0
pygame.mixer.music.load(music_list[num])
pygame.mixer.music.play()
music1=pygame.mixer.Sound(music_list[num])
music_length=music1.get_length()
music_length=int(music_length)
new_logo=pygame.transform.rotate(logo_img,angle)
newRect=new_logo.get_rect(center=(320,200))
pos=(newRect[0],newRect[1])
......@@ -98,6 +112,10 @@ while True:
info=str(playFen)+":"+str(playMiao)
newFen=text.render(str(playFen)+":"+str(playMiao),True,(30,30,40))
print(music_length)
newLength=music_length//60
player=music_length%60
newLengths=text.render(str(playFen)+":"+str(playMiao)+'/'+str(newLength)+":"+str(player),True,(35,70,100))
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
......@@ -106,6 +124,6 @@ while True:
screen.blit(new_logo, pos) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲
screen.blit(newFen,(120,400))
screen.blit(newLengths,(120,400))
# 刷新画面
pygame.display.update()
\ 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