Commit 745147d0 by BellCodeEditor

save project

parent 4128044d
Showing with 38 additions and 13 deletions
...@@ -12,14 +12,14 @@ last_img = pygame.image.load('last.png') # 上一曲按钮 ...@@ -12,14 +12,14 @@ last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮 next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 中间logo logo_img = pygame.image.load('logo.png') # 中间logo
s=0.55 g=0.55
click=0 click=0
f=-1 f=-1
m=[] m=[]
s="C:\\Users\\5\\Desktop\\test" path="C:\\Users\\5\\Desktop\\test"
c=os.listdir(s) c=os.listdir(path)
for i in c: for i in c:
if c[-4:]=='.wav' or c[-4:]=='.ogg': if i[-4:]==".wav" or i[-4:]==".ogg":
m.append(i) m.append(i)
k=stop_img k=stop_img
while True: while True:
...@@ -28,16 +28,16 @@ while True: ...@@ -28,16 +28,16 @@ while True:
exit() exit()
if event.type==locals.KEYDOWN: if event.type==locals.KEYDOWN:
if event.key==locals.K_UP: if event.key==locals.K_UP:
s +=0.05 g +=0.05
if s>1: if g>1:
s=1 g=1
pygame.mixer.music.set_volume(s) pygame.mixer.music.set_volume(g)
if event.type==locals.KEYDOWN: if event.type==locals.KEYDOWN:
if event.key==locals.K_DOWN: if event.key==locals.K_DOWN:
s -=0.05 g-=0.05
if s<0: if g<0:
s=0 g=0
pygame.mixer.music.set_volume(s) pygame.mixer.music.set_volume(g)
if event.type==locals.MOUSEBUTTONDOWN: if event.type==locals.MOUSEBUTTONDOWN:
if event.button==1: if event.button==1:
x,y=event.pos x,y=event.pos
...@@ -52,14 +52,39 @@ while True: ...@@ -52,14 +52,39 @@ while True:
else: else:
k=play_img k=play_img
pygame.mixer.music.pause() pygame.mixer.music.pause()
if x>120 and x<220 and y>350 and y<450:
f-=1
if f<0:
f=len(m)-1
pygame.mixer.music.load(path+"\\"+m[f])
pygame.mixer.music.play()
if x>420 and x<520 and y>350 and y<450:
f+=1
if f>len(m)-1:
f=0
pygame.mixer.music.load(path+"\\"+m[f])
pygame.mixer.music.play()
if pygame.mixer.music.get_busy()==False: if pygame.mixer.music.get_busy()==False:
f+=1 f+=1
if f>len(m)-1: if f>len(m)-1:
f=0 f=0
pygame.mixer.music.load(s+ '\\'+m[f])
pygame.mixer.music.load(path+"\\"+m[f])
pygame.mixer.music.play() pygame.mixer.music.play()
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(k, (270, 330)) # 暂停按钮 screen.blit(k, (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