【发布时间】:2014-03-25 16:20:22
【问题描述】:
这可能是一个愚蠢的问题,但这是一个我找不到文档的愚蠢问题。
Pygame 为我提供了 display.set.mode() 的这些标志:
pygame.FULLSCREEN create a fullscreen display
pygame.DOUBLEBUF recommended for HWSURFACE or OPENGL
pygame.HWSURFACE hardware accelerated, only in FULLSCREEN
pygame.OPENGL create an OpenGL renderable display
pygame.RESIZABLE display window should be sizeable
pygame.NOFRAME display window will have no border or controls
好的,我可以进入全屏模式了。现在这是我的代码:
__author__ = 'EricsonWillians'
from pygame import *
import ctypes
init()
user32 = ctypes.windll.user32
screenSize = user32.GetSystemMetrics(0)/2, user32.GetSystemMetrics(1)/2
size = (screenSize)
screen = display.set_mode(size)
display.set_caption("Game")
done = False
clock = time.Clock()
def keyPressed(inputKey):
keysPressed = key.get_pressed()
if keysPressed[inputKey]:
return True
else:
return False
while not done:
for e in event.get():
if e.type == QUIT:
done = True
if keyPressed(K_F10):
if screen == display.set_mode(size):
screen = display.set_mode(size, FULLSCREEN)
else:
screen = display.set_mode(size, "What flag should I put here for 'windowed'?")
screen.fill((0,0,0))
display.flip()
clock.tick(60)
quit()
没有办法“切换回”全屏模式,因为在 SDL 中没有“WINDOWED”标志。
并且“pygame.display.toggle_fullscreen()”不起作用。 (至少,我无法让它工作)。
我试过“-1”或“0”或“非全屏”,但它们都不起作用(用“0”作为标志,屏幕变得“奇怪”..我不知道会发生什么哈哈,但它不是窗口)。
【问题讨论】:
标签: python pygame toggle fullscreen exit