def _setup_video():
"Ininitializes a new pygame screen using the framebuffer"
# Based on "Python GUI in Linux frame buffer"
# http://www.karoltomala.com/blog/?p=679
disp_no = os.getenv("DISPLAY")
# Check which frame buffer drivers are available
# Start with fbcon since directfb hangs with composite output
drivers = ['x11', 'fbcon', 'directfb', 'svgalib', 'Quartz']
found = False
for driver in drivers:
# Make sure that SDL_VIDEODRIVER is set
if not os.getenv('SDL_VIDEODRIVER'):
os.putenv('SDL_VIDEODRIVER', driver)
try:
pygame.display.init()
except pygame.error:
logger.error('Driver: {0} failed.'.format(driver))
continue
found = True
break
if not found:
logger.error('No suitable SDL video driver found to start the event subsystem, pygame joysticks may not work.')
评论列表
文章目录