Commit 1e443bf0 by BellCodeEditor

save project

parent 272dec02
Showing with 15 additions and 9 deletions
...@@ -6,14 +6,14 @@ import random ...@@ -6,14 +6,14 @@ import random
pygame.init() pygame.init()
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
#FPSLOCK=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') # 播放按钮
stop_img = pygame.image.load('stop.png') # 暂停按钮 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.ttf',14)
music_list = [] music_list = []
path = "C:\\Users\\Administrator\\Desktop\\awa" path = "C:\\Users\\Administrator\\Desktop\\awa"
filelist = os.listdir(path) filelist = os.listdir(path)
...@@ -26,6 +26,9 @@ pygame.mixer.music.set_volume(volume) ...@@ -26,6 +26,9 @@ pygame.mixer.music.set_volume(volume)
click = 0 click = 0
play_button = stop_img play_button = stop_img
angle = 0 angle = 0
lcl=0
a=0
c=0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -83,12 +86,12 @@ while True: ...@@ -83,12 +86,12 @@ while True:
num = 0 num = 0
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_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)
pm=play_time//60 pm=play_time//60
ps=play_time%60 ps=play_time%60
io=str(pm)+":"+str(ps) info=str(pm)+":"+str(ps)
new_logo = pygame.transform.rotate(logo_img, angle) new_logo = pygame.transform.rotate(logo_img, angle)
newRect=new_logo.get_rect(center=(320,200)) newRect=new_logo.get_rect(center=(320,200))
...@@ -99,13 +102,15 @@ while True: ...@@ -99,13 +102,15 @@ 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))
b=random.randint(0,255)
n=random.randint(0,255) lcl=random.randint(0,255)
m=random.randint(0,255) a=random.randint(0,255)
c=random.randint(0,255)
scoreSurf=basic_font.render(info,True,(b,n,m)) scoreSurf=basic_font.render(info,True,(lcl,a,c))
screen.blit(scoreSurf,(120,440)) screen.blit(scoreSurf,(120,440))
pygame.display.update() pygame.display.update()
#FPSLOCK.tick(9)
\ 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