Commit b40cb74b by BellCodeEditor

save project

parent 6d33df65
Showing with 17 additions and 3 deletions
...@@ -5,6 +5,8 @@ import os ...@@ -5,6 +5,8 @@ import os
pygame.init() # 初始化 pygame.init() # 初始化
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
fps = pygame.time.Clock()
# 载入图片、资源 # 载入图片、资源
bg_img = pygame.image.load('background.png') # 背景图 bg_img = pygame.image.load('background.png') # 背景图
play_img = pygame.image.load('play.png') # 播放按钮 play_img = pygame.image.load('play.png') # 播放按钮
...@@ -12,6 +14,7 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮 ...@@ -12,6 +14,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_front = pygame.font.Font('neuropol.ttf',14)
# 音乐 # 音乐
music_list = [] music_list = []
...@@ -73,6 +76,12 @@ while True: ...@@ -73,6 +76,12 @@ while True:
play_button = stop_img play_button = stop_img
click = 0 click = 0
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)
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num += 1 num += 1
if num > len(filelist)-1: if num > len(filelist)-1:
...@@ -82,7 +91,8 @@ while True: ...@@ -82,7 +91,8 @@ while True:
pygame.mixer.music.play() pygame.mixer.music.play()
new_logo = pygame.transform.rotate(logo_img,angle) new_logo = pygame.transform.rotate(logo_img,angle)
angle += 1 if play_button == stop_img:
angle += 1
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])
...@@ -92,5 +102,9 @@ while True: ...@@ -92,5 +102,9 @@ while True:
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)) # 下一曲
scoreSurf = basic_front.render(info,True,(255,255,255))
screen.blit(scoreSurf,(120,440))
# 刷新画面 # 刷新画面
pygame.display.update()
\ No newline at end of file pygame.display.update()
fps.tick(70)
\ 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