Commit 24b07aca by BellCodeEditor

save project

parent 91fc7481
Showing with 27 additions and 14 deletions
...@@ -12,7 +12,7 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮 ...@@ -12,7 +12,7 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img = pygame.image.load('last.png') # 上一曲按钮 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_img = pygame.image.load('logo.png') # 下一曲按钮
basic_font = pygame.font.Font('neuropol.tty',14)
music_list = [] music_list = []
path = os.path.join("C:\\Users\\777\\Desktop\\mi") path = os.path.join("C:\\Users\\777\\Desktop\\mi")
filelist = os.listdir(path) filelist = os.listdir(path)
...@@ -31,12 +31,12 @@ while True: ...@@ -31,12 +31,12 @@ while True:
exit() exit()
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.key == locals.K_w: if event.key == locals.K_UP:
volume += 0.1 volume += 0.1
if volume > 1: if volume > 1:
volume = 1 volume = 1
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
if event.key == locals.K_s: if event.key == locals.K_DOWN:
volume -= 0.1 volume -= 0.1
if volume < 0: if volume < 0:
volume = 0 volume = 0
...@@ -60,11 +60,10 @@ while True: ...@@ -60,11 +60,10 @@ while True:
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: click = 0
click += 2 music1 = pygame.mixer.Sound(path + '\\' + music_list[num])
else: music_length = music1.get_length()
click += 1 music_length = int(music_length)
if x > 120 and x < 220 and y > 350 and y < 400: if x > 120 and x < 220 and y > 350 and y < 400:
num -= 1 num -= 1
if num < 0: if num < 0:
...@@ -72,22 +71,31 @@ while True: ...@@ -72,22 +71,31 @@ while True:
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: click = 0
click += 2 music1 = pygame.mixer.Sound(path + '\\' + music_list[num])
else: music_length = music1.get_length()
click += 1 music_length = int(music_length)
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num += 1 num += 1
if num > len(music_list)-1: if num > len(music_list)-1:
num = 0 num = 0
music1 = pygame.mixer.Sound(path + '\\' + music_list[num])
music_length = music1.get_length()
music_length = int(music_length)
pygame.mixer.music.load(os.path.join(path,music_list[num])) pygame.mixer.music.load(os.path.join(path,music_list[num]))
pygame.mixer.music.play() pygame.mixer.music.play()
play_time = pygame.mixer.music.get_pos() play_time = pygame.mixer.music.get_pos()
play_time = int(play_time/1000) play_time = int(play_time/1000)
play_m = play_time//60 play_m = play_time//60
play_s = play_time % 60 play_s = play_time % 60
if play_s < 10:
play_s = '0' + str(play_s)
into = str(play_m) + ":" + str(play_s) into = str(play_m) + ":" + str(play_s)
music_m = play_time//60
music_s = play_time % 60
if music_s < 10:
music_s = '0' + str(music_s)
into2 = str(music_m) + ":" + str(music_s)
new_logo = pygame.transform.notate(logo_img,angle) new_logo = pygame.transform.notate(logo_img,angle)
newRect = new_logo.get_rect(center=(320,200)) newRect = new_logo.get_rect(center=(320,200))
pos = (newRect[0],newRect[1]) pos = (newRect[0],newRect[1])
...@@ -96,7 +104,11 @@ while True: ...@@ -96,7 +104,11 @@ while True:
screen.blit(play_button, (270, 330)) screen.blit(play_button, (270, 330))
screen.blit(new_logo,pos) screen.blit(new_logo,pos)
screen.blit(last_img, (120, 350)) screen.blit(last_img, (120, 350))
screen.blit(next_img, (420, 350)) screen.blit(next_img, (420, 350))
scoreSurf = basic_font.render(into,True,(255,255,255))
screen.blit(scoreSurf,(120,440))
scoreSurf = basic_font.render('/'+info2,Ture,(0,0,0))
screen.blit(scoreSurf,(170,440))
pygame.display.update() pygame.display.update()
FPS.tick(60) FPS.tick(60)
\ 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