I'm trying to make a GUI on my PiTFT using pygame. I've loaded the following test code from the CLI without starting X-window:
Code: Select all
import pygame, sys, os
from pygame.locals import *
os.environ["SDL_FBDEV"] = "/dev/fb1"
windowsize = 320, 240
windowtitle = "Drawing"
windowfullscreen = pygame.FULLSCREEN
# set up the colors
BLACK = ( 0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = ( 0, 255, 0)
BLUE = ( 0, 0, 255)
GRAY = ( 192, 192, 192)
pygame.init()
DISPLAYSURF = pygame.display.set_mode(windowsize)
DISPLAYSURF.fill(GRAY)
pygame.draw.rect(DISPLAYSURF, WHITE, (20, 20, 280, 200))
pygame.draw.rect(DISPLAYSURF, BLACK, (40, 40, 240, 160))
pygame.display.set_caption(windowtitle)
while True: # main game loop
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == K_ESCAPE:
pygame.quit()
sys.exit()
pygame.display.update()
Is there anyone that know a way to rotate the screen input? Or mayby some sort of calibrating that's not interfering with the calibartaion in X-window?