def initscreen(width, height) :
#Initialisation
pygame.init()
if headless:
#will not anymore be enabled as pygame will not init the screen if headless
os.putenv('SDL_VIDEODRIVER', 'dummy')
screen = pygame.display.set_mode((1,1))
size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
print "Pygame interface started in dummy mode, framebuffer size: %d x %d" % (size[0], size[1])
else:
#init screen / window or fullscreen
if windowed:
#window mode with w and h submitted to the function
screen = pygame.display.set_mode((width,height),0,32)
pygame.display.set_caption(mytitle)
size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
print "Pygame interface started in window mode, framebuffer size: %d x %d" % (size[0], size[1])
else:
#if FS PUT fb1 as the framebuffer device => pitft, res, 320 x 240
# 29.03.2015... not working anymore on the pitft... with PRE "export SDL_FBDEV=/dev/fb1" IT WORKS!
os.environ["SDL_FBDEV"] = "/dev/fb1"
os.environ["SDL_MOUSEDRV"] = "TSLIB"
os.environ["SDL_MOUSEDEV"] = "/dev/input/touchscreen"
#os.putenv('SDL_VIDEODRIVER', 'fbcon')
#os.putenv('SDL_FBDEV' , '/dev/fb1')
#os.putenv('SDL_MOUSEDRV' , 'TSLIB')
#os.putenv('SDL_MOUSEDEV' , '/dev/input/touchscreen')
#screen = pygame.display.set_mode((0,0), pygame.FULLSCREEN) #not working anymore...
screen = pygame.display.set_mode([320, 240], pygame.FULLSCREEN) #try like so OR without FS Flag?
size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
print "Pygame interface started in fullscreen mode, framebuffer size: %d x %d" % (size[0], size[1])
return screen
评论列表
文章目录