我是PyGame的新手,我正在制作一个游戏。直到我发现,当你将窗口移动到桌面的另一个位置时,游戏会暂时停止。但当我使用pygame.time.get_ticks()时,游戏的滴答声仍在运行
所以我做了一个完全新的程序,只需要必要的代码,它做同样的事情
有人能解释一下为什么会这样做,以及我们是否能解决这个问题吗
import pygame
screen = pygame.display.set_mode((800,600))
pygame.display.set_caption('The Test Program')
running = True
update_counter = 1
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.display.flip()
print(str(update_counter) + " updates")
update_counter += 1
pygame.quit()
quit()
# So try to move the window across your screen and you will see that, prints will stop and they will resume when you will release the click
有人告诉我这很正常,所以我认为这只是在Windows上,但没有解决方案。我在屏幕上放了一个脚本,当光标离开窗口时,它会显示一个暂停符号,使其正常
相关问题 更多 >
编程相关推荐