Commit b802a166 by BellCodeEditor

save project

parent 8e02d524
Showing with 9 additions and 2 deletions
import pygame import pygame
import os import os
from pygame import locals from pygame import locals
FPS=pygame.time.Clock()
pygame.init() # 初始化 pygame.init() # 初始化
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
...@@ -58,15 +58,18 @@ while True: ...@@ -58,15 +58,18 @@ while True:
else: else:
play_button = play_img play_button = play_img
pygame.mixer.music.pause() pygame.mixer.music.pause()
if x>120 and x<220 and y>350 and y<400: if x>120 and x<220 and y>350 and y<400:
list_num-=1 list_num-=1
if list_num<0: if list_num<0:
list_num=len(music_list)-1 list_num=len(music_list)-1
pygame.mixer.music.load(path_+"\\"+music_list[list_num]) pygame.mixer.music.load(path_+"\\"+music_list[list_num])
pygame.mixer.music.play() pygame.mixer.music.play()
click=0 #click=0
play_button=stop_img play_button=stop_img
if x>420 and x<520 and y>350 and y<400: if x>420 and x<520 and y>350 and y<400:
list_num+=1 list_num+=1
if list_num>len(music_list)-1: if list_num>len(music_list)-1:
...@@ -87,8 +90,10 @@ while True: ...@@ -87,8 +90,10 @@ while True:
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))
pos=(newRect[0], newRect[1]) pos=(newRect[0], newRect[1])
if play_button==stop_img:
angle +=1 angle +=1
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮 screen.blit(play_button, (270, 330)) # 暂停按钮
...@@ -97,4 +102,6 @@ while True: ...@@ -97,4 +102,6 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(70)
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