Commit d59c888a by BellCodeEditor

save project

parent d1684d9f
Showing with 21 additions and 2 deletions
import pygame
from pygame import locals
import os
angle = 0
p = 0
pygame.init()
screen = pygame.display.set_mode((640, 480))
bg_img = pygame.image.load('background.png')
......@@ -10,6 +11,7 @@ stop_img = pygame.image.load('stop.png')
last_img = pygame.image.load('last.png')
next_img = pygame.image.load('next.png')
logo_img = pygame.image.load('logo.png')
font = pygame.font.Font("neuropol.ttf",18)
volume=0.2
pygame.mixer.music.set_volume(volume)
click=0
......@@ -50,9 +52,11 @@ while True:
if click%2==0:
pygame.mixer.music.unpause()
play_button=stop_img
p = 0
else:
pygame.mixer.music.pause()
play_button=play_img
p = 1
if x > 120 and x <220 and y > 350 and y < 450:
num -= 1
if num < 0:
......@@ -69,11 +73,25 @@ while True:
pygame.mixer.music.play()
click = 0
play_button = stop_img
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)
text = font.render(info,True,(0,0,0))
# 绘制画面
new_logo = pygame.transform.rotate(logo_img,angle)
newRect = new_logo.get_rect(center = (320,200))
pos = (newRect[0],newRect[1])
if p == 0:
angle += 0.5
else:
angle += 0
screen.blit(bg_img, (0, 0))
screen.blit(play_button, (270, 330))
screen.blit(logo_img, (170, 60))
screen.blit(new_logo,pos)
screen.blit(last_img, (120, 350))
screen.blit(text,(120,440))
screen.blit(next_img, (420, 350))
# 刷新画面
pygame.display.update()
\ 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