[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Center a display rect on screen



Thanks, that worked.

TDH

On Saturday 12 April 2008 22:20, Ian Mallett wrote:
> To center the window do...
> os.environ['SDL_VIDEO_CENTERED'] = '1'
> ...before pygame.init()
>
> To center a rectangle inside the window, the top left is...
> x = (ScreenWidth/2) - (RectWidth/2)
> y = (ScreenHeight/2) - (RectHeight/2)
> TopLeftOfRect = (x,y)
>
> HTH,
> Ian