Commit 78774995 by BellCodeEditor

save project

parent b29e35dd
Showing with 27 additions and 10 deletions
......@@ -16,7 +16,9 @@ Zi_Ti = pygame.font.Font("neuropol.ttf",20)
music_list = ["歌曲1.wav","歌曲2.wav","歌曲3.wav","歌曲4.ogg"]
num = -1
Sound=pygame.mixer.Sound(music_list[num])
sd=Sound.get_length()
sd=int(sd)
volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
......@@ -38,7 +40,7 @@ while True:
if volume < 0:
volume = 0
pygame.mixer.music.set_volume(volume)
if event.type == locals.MOUSEBUTTONDOWN:
if event.button == 1: # 左击
x, y = event.pos
......@@ -58,6 +60,9 @@ while True:
num = 0
pygame.mixer.music.load(music_list[num])
pygame.mixer.music.play()
Sound=pygame.mixer.Sound(music_list[num])
sd=Sound.get_length()
sd=int(sd)
play_button = stop_img
if click % 2 == 0:
click += 2
......@@ -70,36 +75,47 @@ while True:
num = len(music_list) - 1
pygame.mixer.music.load(music_list[num])
pygame.mixer.music.play()
Sound=pygame.mixer.Sound(music_list[num])
sd=Sound.get_length()
sd=int(sd)
play_button = stop_img
if click % 2 == 0:
click += 2
else:
click += 1
pygame_time = pygame.mixer.music.get_pos()
pygame_time_s=pygame_time//1000
pygame_time_w=pygame_time_s//60&60
pygame_time = pygame.mixer.music.get_pos()
pygame_time_s=pygame_time//1000
pygame_time_w=pygame_time_s//60&60
pygame_time_s=str(pygame_time_s)
pygame_time_w=str(pygame_time_w)
pygame_time_s=str(pygame_time_s)
pygame_time_w=str(pygame_time_w)
msd=sd//60
ssd = sd%60
msd=str(msd)
ssd=str(ssd)
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()
Sound=pygame.mixer.Sound(music_list[num])
sd=Sound.get_length()
sd=int(sd)
if Zhuan_Dong == 0:
new_logo = pygame.transform.rotate(logo_img,Xuan_Zhuan)
new_xy = new_logo.get_rect(center=(320,200))
Xuan_Zhuan += 1
xy = (new_xy[0],new_xy[1])
my=Zi_Ti.render(pygame_time_w+":"+pygame_time_s,True,(0,0,0))
my=Zi_Ti.render(pygame_time_w+":"+pygame_time_s+"/"+msd+":"+ssd,True,(0,0,0))
# 绘制画面c
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
screen.blit(new_logo, xy) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350))
screen.blit(my, (120, 435)) # 下一曲
screen.blit(my, (120, 435))
# 刷新画面
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